Project

General

Profile

« Previous | Next » 

Revision 4146

Added by daigle over 16 years ago

Add verbose debug statements. These are toggled by the test.printdebug property in metacat.properties

View differences:

test/edu/ucsb/nceas/metacattest/AccessControlTest.java
34 34
import java.util.TimeZone;
35 35
import java.util.Vector;
36 36

  
37
import edu.ucsb.nceas.MCTestCase;
37 38
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
38 39
import edu.ucsb.nceas.metacat.client.Metacat;
39 40
import edu.ucsb.nceas.metacat.client.MetacatAuthException;
......
41 42
import edu.ucsb.nceas.metacat.client.MetacatFactory;
42 43
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
43 44
import edu.ucsb.nceas.metacat.service.PropertyService;
44
import edu.ucsb.nceas.metacat.util.SystemUtil;
45 45
import edu.ucsb.nceas.utilities.IOUtil;
46 46
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
47 47
import junit.framework.Test;
48
import junit.framework.TestCase;
49 48
import junit.framework.TestSuite;
50 49
import java.io.File;
51 50

  
......
53 52
 * A JUnit test for testing Access Control in Metacat
54 53
 */
55 54
public class AccessControlTest
56
    extends TestCase {
55
    extends MCTestCase {
57 56

  
58 57
    private static String metacatUrl;
59 58
    private static String username;
......
62 61
	private static String anotherpassword;
63 62
	static {
64 63
		try {
65
		    metacatUrl = SystemUtil.getServletURL();
64
		    metacatUrl = PropertyService.getProperty("test.metacat.url");
66 65
			username = PropertyService.getProperty("test.mcuser");
67 66
			password = PropertyService.getProperty("test.mcpassword");
68 67
			anotheruser = PropertyService.getProperty("test.mcanotheruser");
......
254 253
                                 String onlineAccessBlock1,
255 254
                                 String onlineAccessBlock2) {
256 255

  
256
    	debug("getTestEmlDoc(): title=" + title + " inlineData1=" + inlineData1  + 
257
    			" inlineData2=" + inlineData2 + " onlineUrl1=" + onlineUrl1 + 
258
    			 " onlineUrl2=" + onlineUrl2 + " docAccessBlock=" + docAccessBlock + 
259
    			 " inlineAccessBlock1=" + inlineAccessBlock1 + 
260
    			 " inlineAccessBlock2=" + inlineAccessBlock2 + 
261
    			 " onlineAccessBlock1=" + onlineAccessBlock1 + 
262
    			 " onlineAccessBlock2=" + onlineAccessBlock2 );
257 263
        String testDocument = "";
258 264
        testDocument = testDocument + testEml_201_Header +
259 265
            "<dataset scope=\"document\"><title>" + title + "</title>" +
......
338 344
     */
339 345
    public void setUp() {
340 346
        try {
341
            System.err.println("Test Metacat: " + metacatUrl);
347
            debug("Test Metacat: " + metacatUrl);
342 348
            m = MetacatFactory.createMetacatConnection(metacatUrl);
343 349
        }
344 350
        catch (MetacatInaccessibleException mie) {
......
444 450
    public void testAllowFirst()
445 451
    {
446 452
    	try {
453
    		debug("\nRunning: testAllowFirst test");
447 454
	    	newdocid = generateDocid();	        
448 455
	        //====1 inserts a document with access  rules (allowFirst) - allow READ rule for another user,
449 456
	        // deny  READ rule for public.
......
455 462
	        accessRules.add(accessRule1);
456 463
	        accessRules.add(accessRule2);
457 464
	        String access = getAccessBlock(accessRules, ALLOWFIRST);
458
	        System.out.println("the access part is "+access);
465
	        debug("Test 1: the access part is " + access);
459 466
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
460 467
                    null, null, null,
461 468
                    null, access ,
462 469
                    null, null, null, null);
463 470
	        // login
471
	        debug("logging in as: username=" + username + " password=" + password);
464 472
	        m.login(username, password);
465 473
	        insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
474
	        debug("logging out");
466 475
	        m.logout();
467 476
	        //login as another user
477
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
468 478
	        m.login(anotheruser, anotherpassword);
469 479
	        //fails to read this document
470 480
	        readDocidWhichEqualsDoc(newdocid + ".1", testdocument, FAILURE, true);
......
480 490
            //fails to delete the document
481 491
            deleteDocid(newdocid + ".1", FAILURE, true);
482 492
            //logout
493
	        debug("logging out");
483 494
            m.logout();
484 495
            
485 496
            //====2 inserts a document with access  rules (allowFirst) - allow READ and WRITE rule for another user,
......
492 503
	        accessRules.add(accessRule1);
493 504
	        accessRules.add(accessRule2);
494 505
	        access = getAccessBlock(accessRules, ALLOWFIRST);
495
	        System.out.println("the access part is "+access);
506
	        debug("Test 2: the access part is " + access);
496 507
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
497 508
                    null, null, null,
498 509
                    null, access ,
499 510
                    null, null, null, null);
500 511
	        // login
512
	        debug("logging in as: username=" + username + " password=" + password);
501 513
	        m.login(username, password);
502 514
	        updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
515
	        debug("logging out");
503 516
	        m.logout();
504 517
	        //login as another user
518
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
505 519
	        m.login(anotheruser, anotherpassword);
506 520
	        //fails to read this document
507 521
	        readDocidWhichEqualsDoc(newdocid + ".2", testdocument, FAILURE, true);
......
517 531
            //fails to delete the document
518 532
            deleteDocid(newdocid + ".2", FAILURE, true);
519 533
            //logout
534
	        debug("logging out");
520 535
            m.logout();
521 536
            
522 537
             //====3 inserts a document with access  rules (allowFirst) - allow ALL rule for another user,
......
529 544
	        accessRules.add(accessRule1);
530 545
	        accessRules.add(accessRule2);
531 546
	        access = getAccessBlock(accessRules, ALLOWFIRST);
532
	        System.out.println("the access part is "+access);
547
	        debug("Test 3; the access part is " + access);
533 548
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
534 549
                    null, null, null,
535 550
                    null, access ,
536 551
                    null, null, null, null);
537 552
	        // login
553
	        debug("logging in as: username=" + username + " password=" + password);
538 554
	        m.login(username, password);
539 555
	        updateDocid(newdocid + ".3", testdocument, SUCCESS, false);
556
	        debug("logging out");
540 557
	        m.logout();
541 558
	        //login as another user
559
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
542 560
	        m.login(anotheruser, anotherpassword);
543 561
	        //fails to read this document
544 562
	        readDocidWhichEqualsDoc(newdocid + ".3", testdocument, FAILURE, true);
......
554 572
            //fails to delete the document
555 573
            deleteDocid(newdocid + ".3", FAILURE, true);
556 574
            //logout
575
	        debug("logging out");
557 576
            m.logout();
558 577
            
559 578
            
......
569 588
	        accessRules.add(accessRule1);
570 589
	        accessRules.add(accessRule2);
571 590
	        access = getAccessBlock(accessRules, ALLOWFIRST);
572
	        System.out.println("the access part is "+access);
591
	        debug("Test 4: the access part is " + access);
573 592
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
574 593
                    null, null, null,
575 594
                    null, access ,
576 595
                    null, null, null, null);
577 596
	        // login
597
	        debug("logging in as: username=" + username + " password=" + password);
578 598
	        m.login(username, password);
579 599
	        updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
580 600
	        m.logout();
601
	        debug("logging out");
581 602
	        //login as another user
603
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
582 604
	        m.login(anotheruser, anotherpassword);
583 605
	        //fails to read this document
584 606
	        readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
......
606 628
	        accessRules.add(accessRule1);
607 629
	        accessRules.add(accessRule2);
608 630
	        access = getAccessBlock(accessRules, ALLOWFIRST);
609
	        System.out.println("the access part is "+access);
631
	        debug("Test 5: the access part is " + access);
610 632
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
611 633
                    null, null, null,
612 634
                    null, access ,
613 635
                    null, null, null, null);
614 636
	        // login
637
	        debug("logging in as: username=" + username + " password=" + password);
615 638
	        m.login(username, password);
616 639
	        updateDocid(newdocid + ".5", testdocument, SUCCESS, false);
640
	        debug("logging out");
617 641
	        m.logout();
618 642
	        //login as another user
643
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
619 644
	        m.login(anotheruser, anotherpassword);
620 645
	        //fails to read this document
621 646
	        readDocidWhichEqualsDoc(newdocid + ".5", testdocument, FAILURE, true);
......
631 656
            //fails to delete the document
632 657
            deleteDocid(newdocid + ".6", FAILURE, true);
633 658
            //logout
659
	        debug("logging out");
634 660
            m.logout();
635 661
            
636 662
            
......
646 672
	        accessRules.add(accessRule1);
647 673
	        accessRules.add(accessRule2);
648 674
	        access = getAccessBlock(accessRules, ALLOWFIRST);
649
	        System.out.println("the access part is "+access);
675
	        debug("Test 6: the access part is " + access);
650 676
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
651 677
                    null, null, null,
652 678
                    null, access ,
653 679
                    null, null, null, null);
654 680
	        // login
681
	        debug("logging in as: username=" + username + " password=" + password);
655 682
	        m.login(username, password);
656 683
	        updateDocid(newdocid + ".7", testdocument, SUCCESS, false);
684
	        debug("logging out");
657 685
	        m.logout();
658 686
	        //login as another user
687
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
659 688
	        m.login(anotheruser, anotherpassword);
660 689
	        //fails to read this document
661 690
	        readDocidWhichEqualsDoc(newdocid + ".7", testdocument, FAILURE, true);
......
671 700
            //fails to delete the document
672 701
            deleteDocid(newdocid + ".7", FAILURE, true);
673 702
            //logout
703
	        debug("logging out");
674 704
            m.logout();
675 705
            
676 706
            //====7 inserts a document with access  rules (allowFirst) - allow READ and WRITE rule for another 
......
684 714
	        accessRules.add(accessRule1);
685 715
	        accessRules.add(accessRule2);
686 716
	        access = getAccessBlock(accessRules, ALLOWFIRST);
687
	        System.out.println("the access part is "+access);
717
	        debug("Test 7: the access part is "+access);
688 718
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
689 719
                    null, null, null,
690 720
                    null, access ,
691 721
                    null, null, null, null);
692 722
	        // login
723
	        debug("logging in as: username=" + username + " password=" + password);
693 724
	        m.login(username, password);
694 725
	        updateDocid(newdocid + ".8", testdocument, SUCCESS, false);
726
	        debug("logging out");
695 727
	        m.logout();
696 728
	        //login as another user
729
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
697 730
	        m.login(anotheruser, anotherpassword);
698 731
	        //fails to read this document
699 732
	        readDocidWhichEqualsDoc(newdocid + ".8", testdocument, FAILURE, true);
......
709 742
            //fails to delete the document
710 743
            deleteDocid(newdocid + ".8", FAILURE, true);
711 744
            //logout
745
	        debug("logging out");
712 746
            m.logout();
713 747
            
714 748
             //====8 inserts a document with access  rules (allowFirst) - allow ALL rule for another user,
......
722 756
	        accessRules.add(accessRule1);
723 757
	        accessRules.add(accessRule2);
724 758
	        access = getAccessBlock(accessRules, ALLOWFIRST);
725
	        System.out.println("the access part is "+access);
759
	        debug("Test 8: the access part is " + access);
726 760
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
727 761
                    null, null, null,
728 762
                    null, access ,
729 763
                    null, null, null, null);
730 764
	        // login
765
	        debug("logging in as: username=" + username + " password=" + password);
731 766
	        m.login(username, password);
732 767
	        updateDocid(newdocid + ".9", testdocument, SUCCESS, false);
768
	        debug("logging out");
733 769
	        m.logout();
734 770
	        //login as another user
771
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
735 772
	        m.login(anotheruser, anotherpassword);
736 773
	        //fails to read this document
737 774
	        readDocidWhichEqualsDoc(newdocid + ".9", testdocument, FAILURE, true);
......
747 784
            //fails to delete the document
748 785
            deleteDocid(newdocid + ".9", FAILURE, true);
749 786
            //logout
787
	        debug("logging out");
750 788
            m.logout();
751 789
            
752 790
            
......
763 801
	        accessRules.add(accessRule1);
764 802
	        accessRules.add(accessRule2);
765 803
	        access = getAccessBlock(accessRules, ALLOWFIRST);
766
	        System.out.println("the access part is "+access);
804
	        debug("Test 9: the access part is " + access);
767 805
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
768 806
                    null, null, null,
769 807
                    null, access ,
770 808
                    null, null, null, null);
771 809
	        // login
810
	        debug("logging in as: username=" + username + " password=" + password);
772 811
	        m.login(username, password);
773 812
	        updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
813
	        debug("logging out");
774 814
	        m.logout();
775 815
	        //login as another user
816
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
776 817
	        m.login(anotheruser, anotherpassword);
777 818
	        //succeed to read this document
778 819
	        readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
......
788 829
            //fails to delete the document
789 830
            deleteDocid(newdocid + ".10", FAILURE, true);
790 831
            //logout
832
	        debug("logging out");
791 833
            m.logout();
792 834
	        
793 835
            
......
802 844
	        accessRules.add(accessRule1);
803 845
	        accessRules.add(accessRule2);
804 846
	        access = getAccessBlock(accessRules, ALLOWFIRST);
805
	        System.out.println("the access part is "+access);
847
	        debug("Test 10: the access part is " + access);
806 848
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
807 849
                    null, null, null,
808 850
                    null, access ,
809 851
                    null, null, null, null);
810 852
	        // login
853
	        debug("logging in as: username=" + username + " password=" + password);
811 854
	        m.login(username, password);
812 855
	        updateDocid(newdocid + ".11", testdocument, SUCCESS, false);
856
	        debug("logging out");
813 857
	        m.logout();
814 858
	        //login as another user
859
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
815 860
	        m.login(anotheruser, anotherpassword);
816 861
	        //fails to read this document
817 862
	        readDocidWhichEqualsDoc(newdocid + ".11", testdocument, FAILURE, true);
......
827 872
            //fails to delete the document
828 873
            deleteDocid(newdocid + ".12", FAILURE, true);
829 874
            //logout
875
	        debug("logging out");
830 876
            m.logout();
831 877
	    }
832 878
	    catch (MetacatAuthException mae) {
......
906 952
     */
907 953
    public void testDenyFirst()
908 954
    {
955
    	debug("\nRunning: testDenyFirst()");
909 956
    	try {
910 957
	    	newdocid = generateDocid();	        
911 958
	        //====1 inserts a document with access  rules (denyFirst) - allow READ rule for another user,
......
918 965
	        accessRules.add(accessRule1);
919 966
	        accessRules.add(accessRule2);
920 967
	        String access = getAccessBlock(accessRules, DENYFIRST);
921
	        System.out.println("the access part is "+access);
968
	        debug("Test 1: the access part is " + access);
922 969
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
923 970
                    null, null, null,
924 971
                    null, access ,
925 972
                    null, null, null, null);
926 973
	        // login
974
	        debug("logging in as: username=" + username + " password=" + password);
927 975
	        m.login(username, password);
928 976
	        insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
977
	        debug("logging out");
929 978
	        m.logout();
930 979
	        //login as another user
980
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
931 981
	        m.login(anotheruser, anotherpassword);
932 982
	        //succeeds to read this document
933 983
	        readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
......
943 993
            //fails to delete the document
944 994
            deleteDocid(newdocid + ".1", FAILURE, true);
945 995
            //logout
996
	        debug("logging out");
946 997
            m.logout();
947 998
            
948 999
            //====2 inserts a document with access  rules (denyFirst) - allow READ and WRITE rule for another user,
......
955 1006
	        accessRules.add(accessRule1);
956 1007
	        accessRules.add(accessRule2);
957 1008
	        access = getAccessBlock(accessRules, DENYFIRST);
958
	        System.out.println("the access part is "+access);
1009
	        debug("Test 2: the access part is " + access);
959 1010
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
960 1011
                    null, null, null,
961 1012
                    null, access ,
962 1013
                    null, null, null, null);
963 1014
	        // login
1015
	        debug("logging in as: username=" + username + " password=" + password);
964 1016
	        m.login(username, password);
965 1017
	        updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
1018
	        debug("logging out");
966 1019
	        m.logout();
967 1020
	        //login as another user
1021
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
968 1022
	        m.login(anotheruser, anotherpassword);
969 1023
	        //succeeds to read this document
970 1024
	        readDocidWhichEqualsDoc(newdocid + ".2", testdocument, SUCCESS, false);
......
980 1034
            //fails to delete the document
981 1035
            deleteDocid(newdocid + ".3", FAILURE, true);
982 1036
            //logout
1037
	        debug("logging out");
983 1038
            m.logout();
984 1039
            
985 1040
             //====3 inserts a document with access  rules (denyFirst) - allow ALL rule for another user,
......
992 1047
	        accessRules.add(accessRule1);
993 1048
	        accessRules.add(accessRule2);
994 1049
	        access = getAccessBlock(accessRules, DENYFIRST);
995
	        System.out.println("the access part is "+access);
1050
	        debug("Test 3: the access part is " + access);
996 1051
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
997 1052
                    null, null, null,
998 1053
                    null, access ,
999 1054
                    null, null, null, null);
1000 1055
	        // login
1056
	        debug("logging in as: username=" + username + " password=" + password);
1001 1057
	        m.login(username, password);
1002 1058
	        updateDocid(newdocid + ".4", testdocument, SUCCESS, false);
1059
	        debug("logging out");
1003 1060
	        m.logout();
1004 1061
	        //login as another user
1062
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1005 1063
	        m.login(anotheruser, anotherpassword);
1006 1064
	        //succeeds to read this document
1007 1065
	        readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
......
1016 1074
            //succeeds to delete the document
1017 1075
            deleteDocid(newdocid + ".6", SUCCESS, false);
1018 1076
            //logout
1077
	        debug("logging out");
1019 1078
            m.logout();
1020 1079
            
1021 1080
            
......
1031 1090
	        accessRules.add(accessRule1);
1032 1091
	        accessRules.add(accessRule2);
1033 1092
	        access = getAccessBlock(accessRules, DENYFIRST);
1034
	        System.out.println("the access part is "+access);
1093
	        debug("Test 4: the access part is " + access);
1035 1094
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
1036 1095
                    null, null, null,
1037 1096
                    null, access ,
1038 1097
                    null, null, null, null);
1039 1098
	        // login
1099
	        debug("logging in as: username=" + username + " password=" + password);
1040 1100
	        m.login(username, password);
1041 1101
	        insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
1102
	        debug("logging out");
1042 1103
	        m.logout();
1043 1104
	        //login as another user
1105
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1044 1106
	        m.login(anotheruser, anotherpassword);
1045 1107
	        //succeeds to read this document
1046 1108
	        readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
......
1056 1118
            //fails to delete the document
1057 1119
            deleteDocid(newdocid + ".2", FAILURE, true);
1058 1120
            //logout
1121
	        debug("logging out");
1059 1122
            m.logout();
1060 1123
	        
1061 1124
            
......
1068 1131
	        accessRules.add(accessRule1);
1069 1132
	        accessRules.add(accessRule2);
1070 1133
	        access = getAccessBlock(accessRules, DENYFIRST);
1071
	        System.out.println("the access part is "+access);
1134
	        debug("Test 5: the access part is "+access);
1072 1135
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
1073 1136
                    null, null, null,
1074 1137
                    null, access ,
1075 1138
                    null, null, null, null);
1076 1139
	        // login
1140
	        debug("logging in as: username=" + username + " password=" + password);
1077 1141
	        m.login(username, password);
1078 1142
	        updateDocid(newdocid + ".10", testdocument, SUCCESS, false);
1143
	        debug("logging out");
1079 1144
	        m.logout();
1080 1145
	        //login as another user
1146
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1081 1147
	        m.login(anotheruser, anotherpassword);
1082 1148
	        //succeeds to read this document
1083 1149
	        readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
......
1093 1159
            //fails to delete the document
1094 1160
            deleteDocid(newdocid + ".12", FAILURE, true);
1095 1161
            //logout
1162
	        debug("logging out");
1096 1163
            m.logout();
1097 1164
            
1098 1165
            
......
1108 1175
	        accessRules.add(accessRule1);
1109 1176
	        accessRules.add(accessRule2);
1110 1177
	        access = getAccessBlock(accessRules, DENYFIRST);
1111
	        System.out.println("the access part is "+access);
1178
	        debug("Test 6: the access part is "+access);
1112 1179
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
1113 1180
                    null, null, null,
1114 1181
                    null, access ,
1115 1182
                    null, null, null, null);
1116 1183
	        // login
1184
	        debug("logging in as: username=" + username + " password=" + password);
1117 1185
	        m.login(username, password);
1118 1186
	        updateDocid(newdocid + ".13", testdocument, SUCCESS, false);
1187
	        debug("logging out");
1119 1188
	        m.logout();
1120 1189
	        //login as another user
1190
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1121 1191
	        m.login(anotheruser, anotherpassword);
1122 1192
	        //succeeds to read this document
1123 1193
	        readDocidWhichEqualsDoc(newdocid + ".13", testdocument, SUCCESS, false);
......
1133 1203
            //fails to delete the document
1134 1204
            deleteDocid(newdocid + ".13", FAILURE, true);
1135 1205
            //logout
1206
	        debug("logging out");
1136 1207
            m.logout();
1137 1208
            
1138 1209
            //====7 inserts a document with access  rules (allowFirst) - allow READ and WRITE rule for another 
......
1146 1217
	        accessRules.add(accessRule1);
1147 1218
	        accessRules.add(accessRule2);
1148 1219
	        access = getAccessBlock(accessRules, DENYFIRST);
1149
	        System.out.println("the access part is "+access);
1220
	        debug("Test 7: the access part is " + access);
1150 1221
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
1151 1222
                    null, null, null,
1152 1223
                    null, access ,
1153 1224
                    null, null, null, null);
1154 1225
	        // login
1226
	        debug("logging in as: username=" + username + " password=" + password);
1155 1227
	        m.login(username, password);
1156 1228
	        updateDocid(newdocid + ".14", testdocument, SUCCESS, false);
1229
	        debug("logging out");
1157 1230
	        m.logout();
1158 1231
	        //login as another user
1232
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1159 1233
	        m.login(anotheruser, anotherpassword);
1160 1234
	        //succeeds to read this document
1161 1235
	        readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
......
1171 1245
            //fails to delete the document
1172 1246
            deleteDocid(newdocid + ".15", FAILURE, true);
1173 1247
            //logout
1248
	        debug("logging out");
1174 1249
            m.logout();
1175 1250
            
1176 1251
             //====8 inserts a document with access  rules (denyFirst) - allow ALL rule for another user,
......
1184 1259
	        accessRules.add(accessRule1);
1185 1260
	        accessRules.add(accessRule2);
1186 1261
	        access = getAccessBlock(accessRules, DENYFIRST);
1187
	        System.out.println("the access part is "+access);
1262
	        debug("Test 8: the access part is "+access);
1188 1263
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
1189 1264
                    null, null, null,
1190 1265
                    null, access ,
1191 1266
                    null, null, null, null);
1192 1267
	        // login
1268
	        debug("logging in as: username=" + username + " password=" + password);
1193 1269
	        m.login(username, password);
1194 1270
	        updateDocid(newdocid + ".16", testdocument, SUCCESS, false);
1271
	        debug("logging out");
1195 1272
	        m.logout();
1196 1273
	        //login as another user
1274
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1197 1275
	        m.login(anotheruser, anotherpassword);
1198 1276
	        //succeeds to read this document
1199 1277
	        readDocidWhichEqualsDoc(newdocid + ".16", testdocument, SUCCESS, false);
......
1209 1287
            //succeeds to delete the document
1210 1288
            deleteDocid(newdocid + ".18", SUCCESS, false);
1211 1289
            //logout
1290
	        debug("logging out");
1212 1291
            m.logout();
1213 1292
            
1214 1293
            
......
1225 1304
	        accessRules.add(accessRule1);
1226 1305
	        accessRules.add(accessRule2);
1227 1306
	        access = getAccessBlock(accessRules, DENYFIRST);
1228
	        System.out.println("the access part is "+access);
1307
	        debug("Test 9: the access part is " + access);
1229 1308
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
1230 1309
                    null, null, null,
1231 1310
                    null, access ,
1232 1311
                    null, null, null, null);
1233 1312
	        // login
1313
	        debug("logging in as: username=" + username + " password=" + password);
1234 1314
	        m.login(username, password);
1235 1315
	        insertDocid(newdocid + ".1", testdocument, SUCCESS, false);
1316
	        debug("logging out");
1236 1317
	        m.logout();
1237 1318
	        //login as another user
1319
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1238 1320
	        m.login(anotheruser, anotherpassword);
1239 1321
	        //succeed to read this document
1240 1322
	        readDocidWhichEqualsDoc(newdocid + ".1", testdocument, SUCCESS, false);
......
1250 1332
            //fails to delete the document
1251 1333
            deleteDocid(newdocid + ".20", FAILURE, true);
1252 1334
            //logout
1335
	        debug("logging out");
1253 1336
            m.logout();
1254 1337
	        
1255 1338
            
......
1264 1347
	        accessRules.add(accessRule1);
1265 1348
	        accessRules.add(accessRule2);
1266 1349
	        access = getAccessBlock(accessRules, DENYFIRST);
1267
	        System.out.println("the access part is "+access);
1350
	        debug("Test 10: the access part is " + access);
1268 1351
	        testdocument = getTestEmlDoc("Testing user can not read, write and delete a document",
1269 1352
                    null, null, null,
1270 1353
                    null, access ,
1271 1354
                    null, null, null, null);
1272 1355
	        // login
1356
	        debug("logging in as: username=" + username + " password=" + password);
1273 1357
	        m.login(username, password);
1274 1358
	        updateDocid(newdocid + ".21", testdocument, SUCCESS, false);
1359
	        debug("logging out");
1275 1360
	        m.logout();
1276 1361
	        //login as another user
1362
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1277 1363
	        m.login(anotheruser, anotherpassword);
1278 1364
	        //succeeds to read this document
1279 1365
	        readDocidWhichEqualsDoc(newdocid + ".21", testdocument, SUCCESS, false);
......
1289 1375
            //fails to delete the document
1290 1376
            deleteDocid(newdocid + ".22", FAILURE, true);
1291 1377
            //logout
1378
	        debug("logging out");
1292 1379
            m.logout();
1293 1380
	    }
1294 1381
	    catch (MetacatAuthException mae) {
......
1315 1402
     */
1316 1403
    public void documentTest() {
1317 1404
        try {
1405
        	debug("\nRunning: documentTest()");
1318 1406

  
1319 1407
            newdocid = generateDocid();
1320 1408

  
1321 1409
            // login
1410
	        debug("logging in as: username=" + username + " password=" + password);
1322 1411
            m.login(username, password);
1323 1412

  
1324 1413
            // insert a 2.0.0 document
......
1337 1426
                                         null, null, null, null, null);
1338 1427
            updateDocid(newdocid + ".2", testdocument, SUCCESS, false);
1339 1428
            readDocidWhichEqualsDoc(newdocid, testdocument, SUCCESS, false);
1429
	        debug("logging out");
1340 1430
            m.logout();
1341 1431

  
1342 1432

  
1343 1433
            newdocid = generateDocid();
1344 1434

  
1345 1435
            // login
1436
	        debug("logging in as: username=" + username + " password=" + password);
1346 1437
            m.login(username, password);
1347 1438

  
1348 1439
            // insert a document
......
1363 1454

  
1364 1455
            /////////////////////////////
1365 1456
            // check what the another user can do
1457
	        debug("logging out");
1366 1458
            m.logout();
1459
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1367 1460
            m.login(anotheruser, anotherpassword);
1368 1461

  
1369 1462
            // check if the user mentioned is able to read/update/delete the document
......
1373 1466

  
1374 1467
            /////////////////////////////
1375 1468
            // update the document access control - read only
1469
	        debug("logging out");
1376 1470
            m.logout();
1471
	        debug("logging in as: username=" + username + " password=" + password);
1377 1472
            m.login(username, password);
1378 1473

  
1379 1474
            testdocument = getTestEmlDoc("Testing update access block",
......
1385 1480
            readDocidWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
1386 1481

  
1387 1482
            // check if the user mentioned is able to read the document
1483
	        debug("logging out");
1388 1484
            m.logout();
1485
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1389 1486
            m.login(anotheruser, anotherpassword);
1487
            debug(testdocument);
1390 1488
            readDocidWhichEqualsDoc(newdocid + ".3", testdocument, SUCCESS, false);
1391 1489

  
1392 1490
            // should not be able to update the document
......
1408 1506
            // or delete the document
1409 1507
            deleteDocid(newdocid + ".3", FAILURE, true);
1410 1508

  
1509
	        debug("logging out");
1411 1510
            m.logout();
1511
	        debug("logging in as: username=" + username + " password=" + password);
1412 1512
            m.login(username, password);
1413 1513

  
1414 1514
            ///////////////////////////////////
......
1422 1522
            readDocidWhichEqualsDoc(newdocid + ".4", testdocument, SUCCESS, false);
1423 1523
            //System.out.println(testdocument);
1424 1524
            // check if the user mentioned is able to read the document
1525
	        debug("logging out");
1425 1526
            m.logout();
1527
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1426 1528
            m.login(anotheruser, anotherpassword);
1427 1529
            readDocidWhichEqualsDoc(newdocid + ".4", testdocument, FAILURE, true);
1428 1530

  
......
1443 1545
            deleteDocid(newdocid + ".5", FAILURE, true);
1444 1546
            //deleteDocid(newdocid + ".4", FAILURE, true);
1445 1547

  
1548
	        debug("logging out");
1446 1549
            m.logout();
1550
	        debug("logging in as: username=" + username + " password=" + password);
1447 1551
            m.login(username, password);
1448 1552

  
1449 1553
            /////////////////////////////////
......
1457 1561
            readDocidWhichEqualsDoc(newdocid + ".6", testdocument, SUCCESS, false);
1458 1562

  
1459 1563
            // check if the user mentioned is able to read the document
1564
	        debug("logging out");
1460 1565
            m.logout();
1566
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1461 1567
            m.login(anotheruser, anotherpassword);
1462 1568
            readDocidWhichEqualsDoc(newdocid + ".6", testdocument, FAILURE, true);
1463 1569

  
......
1482 1588
            //deleteDocid(newdocid + ".7", FAILURE, true);
1483 1589
            deleteDocid(newdocid + ".6", FAILURE, true);
1484 1590

  
1591
	        debug("logging out");
1485 1592
            m.logout();
1593
	        debug("logging in as: username=" + username + " password=" + password);
1486 1594
            m.login(username, password);
1487 1595

  
1488 1596

  
......
1497 1605
            readDocidWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
1498 1606

  
1499 1607
            // check if the user mentioned is able to read the document
1608
	        debug("logging out");
1500 1609
            m.logout();
1610
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1501 1611
            m.login(anotheruser, anotherpassword);
1502 1612
            readDocidWhichEqualsDoc(newdocid + ".8", testdocument, SUCCESS, false);
1503 1613

  
......
1515 1625
            // try to delete the document
1516 1626
            deleteDocid(newdocid + ".9", FAILURE, true);
1517 1627

  
1628
	        debug("logging out");
1518 1629
            m.logout();
1630
	        debug("logging in as: username=" + username + " password=" + password);
1519 1631
            m.login(username, password);
1520 1632

  
1521 1633

  
......
1530 1642
            readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
1531 1643

  
1532 1644
            // check if the user mentioned is able to read the document
1645
	        debug("logging out");
1533 1646
            m.logout();
1647
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1534 1648
            m.login(anotheruser, anotherpassword);
1535 1649
            readDocidWhichEqualsDoc(newdocid + ".10", testdocument, SUCCESS, false);
1536 1650
            // should not be able to update the document
......
1553 1667
            // deleteDocid(newdocid + ".11", FAILURE, true);
1554 1668
            deleteDocid(newdocid + ".10", FAILURE, true);
1555 1669

  
1670
	        debug("logging out");
1556 1671
            m.logout();
1672
	        debug("logging in as: username=" + username + " password=" + password);
1557 1673
            m.login(username, password);
1558 1674

  
1559 1675

  
......
1569 1685
            readDocidWhichEqualsDoc(newdocid + ".12", testdocument, SUCCESS, false);
1570 1686

  
1571 1687
            // check if the user mentioned is able to read the document
1688
	        debug("logging out");
1572 1689
            m.logout();
1690
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1573 1691
            m.login(anotheruser, anotherpassword);
1574 1692
            readDocidWhichEqualsDoc(newdocid + ".12", testdocument,  SUCCESS, false);
1575 1693

  
......
1593 1711
            //deleteDocid(newdocid + ".13", FAILURE, true);
1594 1712
            deleteDocid(newdocid + ".12", FAILURE, true);
1595 1713

  
1714
	        debug("logging out");
1596 1715
            m.logout();
1716
	        debug("logging in as: username=" + username + " password=" + password);
1597 1717
            m.login(username, password);
1598 1718

  
1599 1719

  
......
1608 1728
            readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
1609 1729

  
1610 1730
            // check if the user mentioned is able to read the document
1731
	        debug("logging out");
1611 1732
            m.logout();
1733
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1612 1734
            m.login(anotheruser, anotherpassword);
1613 1735
            readDocidWhichEqualsDoc(newdocid + ".14", testdocument, SUCCESS, false);
1614 1736

  
......
1633 1755
            // try to delete the document
1634 1756
            deleteDocid(newdocid + ".16", FAILURE, true);
1635 1757

  
1758
	        debug("logging out");
1636 1759
            m.logout();
1760
	        debug("logging in as: username=" + username + " password=" + password);
1637 1761
            m.login(username, password);
1638 1762

  
1639 1763
            /////////////////////////////////
......
1647 1771
            readDocidWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
1648 1772

  
1649 1773
            // check if the user mentioned is able to read the document
1774
	        debug("logging out");
1650 1775
            m.logout();
1776
	        debug("logging in as: anotheruser=" + anotheruser + " anotherpassword=" + anotherpassword);
1651 1777
            m.login(anotheruser, anotherpassword);
1652 1778
            readDocidWhichEqualsDoc(newdocid + ".17", testdocument, SUCCESS, false);
1653 1779

  
......
1672 1798
            // try to delete the document
1673 1799
            deleteDocid(newdocid + ".19", FAILURE, true);
1674 1800

  
1801
	        debug("logging out");
1675 1802
            m.logout();
1676 1803

  
1677 1804
            // delete the document
1805
	        debug("logging in as: username=" + username + " password=" + password);
1678 1806
            m.login(username, password);
1679 1807
            deleteDocid(newdocid + ".19", SUCCESS, false);
1808
	        debug("logging out");
1680 1809
            m.logout();
1681 1810
        }
1682 1811
        catch (MetacatAuthException mae) {
......
1706 1835
     */
1707 1836
    public void AccessControlTestForPublic() {
1708 1837
        try {
1838
        	debug("\nRunning: AccessControlTestForPublic()");
1709 1839

  
1710 1840
            String accessBlock = getAccessBlock(anotheruser, true,
1711 1841
                                         true, false, false, false);
1712 1842
            newdocid = generateDocid();
1713 1843

  
1714 1844
            // login
1845
	        debug("logging in as: username=" + username + " password=" + password);
1715 1846
            m.login(username, password);
1716 1847

  
1717 1848
            onlineDocid = generateDocid();
......
1728 1859
                                    false);
1729 1860

  
1730 1861
            // logoutand login as other user
1862
	        debug("logging out");
1731 1863
            m.logout();
1732 1864

  
1733 1865
            // read the document
......
1765 1897

  
1766 1898
            // delete the document
1767 1899
            deleteDocid(newdocid + ".2", FAILURE, true);
1900
	        debug("logging out");
1768 1901
            m.logout();
1769 1902
        }
1770 1903
        catch (MetacatAuthException mae) {
......
1788 1921

  
1789 1922
    private String insertDocid(String docid, String docText, boolean result,
1790 1923
                               boolean expectKarmaException) {
1924
    	debug("insertDocid(): docid=" + docid + " expectedResult=" + result
1925
				+ " expectKarmaException=" + expectKarmaException);
1791 1926
        String response = null;
1792 1927
        try {
1793 1928
            response = m.insert(docid,
1794 1929
                                new StringReader(testdocument), null);
1795 1930
            if (result) {
1796
                assertTrue( (response.indexOf("<success>") != -1));
1797
                assertTrue(response.indexOf(docid) != -1);
1931
                assertTrue(response, (response.indexOf("<success>") != -1));
1932
                assertTrue(response, response.indexOf(docid) != -1);
1798 1933
            }
1799 1934
            else {
1800
                assertTrue( (response.indexOf("<success>") == -1));
1935
                assertTrue(response, (response.indexOf("<success>") == -1));
1801 1936
            }
1802
            System.err.println(response);
1937
            debug("insertDocid():  response=" + response);
1803 1938
        }
1804 1939
        catch (MetacatInaccessibleException mie) {
1805 1940
            fail("Metacat Inaccessible:\n" + mie.getMessage());
......
1824 1959

  
1825 1960
    private String uploadDocid(String docid, String filePath, boolean result,
1826 1961
                               boolean expectedKarmaException) {
1962
    	debug("uploadDocid(): docid=" + docid + " filePath=" + filePath 
1963
    			+ " expectedResult=" + result + " expectedKarmaException=" + expectedKarmaException);
1827 1964
        String response = null;
1828 1965
        try {
1829 1966
            response = m.upload(docid, new File(filePath));
1830 1967
            if (result) {
1831
                assertTrue( (response.indexOf("<success>") != -1));
1832
                assertTrue(response.indexOf(docid) != -1);
1968
                assertTrue(response, (response.indexOf("<success>") != -1));
1969
                assertTrue(response, response.indexOf(docid) != -1);
1833 1970
            }
1834 1971
            else {
1835
                assertTrue( (response.indexOf("<success>") == -1));
1972
                assertTrue(response,  (response.indexOf("<success>") == -1));
1836 1973
            }
1837
            System.err.println("respose from metacat: " + response);
1974
            debug("uploadDocid():  response=" + response);
1838 1975
        }
1839 1976
        catch (MetacatInaccessibleException mie) {
1840 1977
            fail("Metacat Inaccessible:\n" + mie.getMessage());
......
1848 1985
            if (result) {
1849 1986
                fail("Metacat Error:\n" + me.getMessage());
1850 1987
            } else {
1851
                System.err.println("Metacat Error:\n" + me.getMessage());
1988
                debug("Metacat Error:\n" + me.getMessage());
1852 1989
            }
1853 1990
        }
1854 1991
        catch (Exception e) {
......
1862 1999
     */
1863 2000
    private String updateDocid(String docid, String docText, boolean result,
1864 2001
                               boolean expectedKarmaFailure) {
2002
    	debug("updateDocid(): docid=" + docid + " expectedResult=" + result
2003
				+ " expectedKarmaFailure=" + expectedKarmaFailure);
1865 2004
        String response = null;
1866 2005
        try {
1867 2006
            response = m.update(docid,
1868 2007
                                new StringReader(testdocument), null);
1869 2008

  
1870 2009
            if (result) {
1871
                assertTrue( (response.indexOf("<success>") != -1));
1872
                assertTrue(response.indexOf(docid) != -1);
2010
                assertTrue(response, (response.indexOf("<success>") != -1));
2011
                assertTrue(response, response.indexOf(docid) != -1);
1873 2012
            }
1874 2013
            else {
1875
                assertTrue( (response.indexOf("<success>") == -1));
2014
                assertTrue(response, (response.indexOf("<success>") == -1));
1876 2015
            }
1877
            System.err.println(response);
2016
            debug("updateDocid(): response=" + response);
1878 2017
        }
1879 2018
        catch (MetacatInaccessibleException mie) {
1880 2019
            fail("Metacat Inaccessible:\n" + mie.getMessage());
......
1888 2027
            if (result) {
1889 2028
                fail("Metacat Error:\n" + me.getMessage());
1890 2029
            } else {
1891
                System.err.println("Metacat Error:\n" + me.getMessage());
2030
                debug("Metacat Error:\n" + me.getMessage());
1892 2031
            }
1893 2032
        }
1894 2033
        catch (Exception e) {
......
1902 2041
     * Delete a document into metacat. The expected result is passed as result
1903 2042
     */
1904 2043
    private void deleteDocid(String docid, boolean result,
1905
                             boolean expextedKarmaFailure) {
2044
                             boolean expectedKarmaFailure) {
2045
    	debug("deleteDocid(): docid=" + docid + " expectedResult=" + result
2046
				+ " expectedKarmaFailure=" + expectedKarmaFailure);
1906 2047
        try {
1907 2048
        	Thread.sleep(5000);
1908 2049
            String response = m.delete(docid);
1909 2050
            if (result) {
1910
                assertTrue(response.indexOf("<success>") != -1);
2051
                assertTrue(response, response.indexOf("<success>") != -1);
1911 2052
            }
1912 2053
            else {
1913
                assertTrue(response.indexOf("<success>") == -1);
2054
                assertTrue(response, response.indexOf("<success>") == -1);
1914 2055
            }
1915
            System.err.println(response);
2056
            debug("deleteDocid():  response=" + response);
1916 2057
        }
1917 2058
        catch (MetacatInaccessibleException mie) {
1918 2059
            fail("Metacat Inaccessible:\n" + mie.getMessage());
1919 2060
        }
1920 2061
        catch (InsufficientKarmaException ike) {
1921
            if(!expextedKarmaFailure){
2062
            if(!expectedKarmaFailure){
1922 2063
                fail("Insufficient karma:\n" + ike.getMessage());
1923 2064
            }
1924 2065
        }
......
1926 2067
            if (result) {
1927 2068
                fail("Metacat Error:\n" + me.getMessage());
1928 2069
            } else {
1929
                System.err.println("Metacat Error:\n" + me.getMessage());
2070
                debug("Metacat Error:\n" + me.getMessage());
1930 2071
            }
1931 2072
        }
1932 2073
        catch (Exception e) {
......
1938 2079
     * Read a document from metacat. The expected result is passed as result
1939 2080
     */
1940 2081
    private void readDocid(String docid, boolean result,
1941
                           boolean expextedKarmaFailure) {
2082
                           boolean expectedKarmaFailure) {
2083
    	debug("readDocid(): docid=" + docid + " expectedResult=" + result
2084
				+ " expectedKarmaFailure=" + expectedKarmaFailure);
1942 2085
        try {
1943 2086
            Reader r = m.read(docid);
1944 2087
            String response = IOUtil.getAsString(r, true);
1945 2088

  
1946 2089
            if (!result) {
1947
                assertTrue(response.indexOf("<success>") == -1);
2090
                assertTrue(response, response.indexOf("<success>") == -1);
1948 2091
            }
1949
            // System.err.println(response);
2092
            debug("readDocid():  response=" + response);
1950 2093
        }
1951 2094
        catch (MetacatInaccessibleException mie) {
1952 2095
            fail("Metacat Inaccessible:\n" + mie.getMessage());
1953 2096
        }
1954 2097
        catch (InsufficientKarmaException ike) {
1955
            if (!expextedKarmaFailure) {
2098
            if (!expectedKarmaFailure) {
1956 2099
                fail("Insufficient karma:\n" + ike.getMessage());
1957 2100
            }
1958 2101
        }
......
1971 2114

  
1972 2115
    private void readDocidWhichEqualsDoc(String docid, String testDoc,
1973 2116
                                         boolean result,
1974
                                         boolean expextedKarmaFailure) {
2117
                                         boolean expectedKarmaFailure) {
2118
    	debug("readDocidWhichEqualsDoc(): docid=" + docid + " expectedResult=" + result
2119
				+ " expectedKarmaFailure=" + expectedKarmaFailure);
1975 2120
        try {
1976 2121
            Reader r = m.read(docid);
1977 2122
            String doc = IOUtil.getAsString(r, true);
......
1987 2132
            else {
1988 2133
                assertTrue(doc.indexOf("<error>") != -1);
1989 2134
            }
2135
            debug("readDocidWhichEqualsDoc():  doc=" + doc);
1990 2136
        }
1991 2137
        catch (MetacatInaccessibleException mie) {
1992 2138
            fail("Metacat Inaccessible:\n" + mie.getMessage());
1993 2139
        }
1994 2140
        catch (InsufficientKarmaException ike) {
1995
            if (!expextedKarmaFailure) {
2141
            if (!expectedKarmaFailure) {
1996 2142
                fail("Insufficient karma:\n" + ike.getMessage());
1997 2143
            }
1998 2144
        }

Also available in: Unified diff