Project

General

Profile

« Previous | Next » 

Revision 9089

Added by Jing Tao about 9 years ago

Add the test case 18. Refer https://redmine.dataone.org/issues/6734.

View differences:

SIDTest.java
135 135
	    testCase15();
136 136
	    testCase16();
137 137
        testCase17();
138
        testCase18();
138 139
	}
139 140
	
140 141
	/**
......
930 931
        assertTrue(head.equals(p4));
931 932
      
932 933
    }
934
    
935
    /**
936
     * case 18. P1(S1) <->P2(S1) -> ??  ???<-P5(S1) S1 = P5 (P2 is a type 2 end and P4  is a type 1 end, not an ideal chain)
937
     * @throws Exception
938
     */
939
    private void testCase18() throws Exception {
940
        Identifier s1 = new Identifier();
941
        s1.setValue("S1");
942
        Identifier s2 = new Identifier();
943
        s2.setValue("S2");
944
        Identifier p1 = new Identifier();
945
        p1.setValue("P1");
946
        Identifier p2 = new Identifier();
947
        p2.setValue("P2");
948
        Identifier p3 = new Identifier();
949
        p3.setValue("P3");
950
        Identifier p4 = new Identifier();
951
        p4.setValue("P4");
952
        Identifier p5 = new Identifier();
953
        p5.setValue("P5");
954
       
955
        
956
        SystemMetadata p1Sys = new SystemMetadata();
957
        p1Sys.setIdentifier(p1);
958
        p1Sys.setSeriesId(s1);
959
        p1Sys.setObsoletedBy(p2);
960
        p1Sys.setDateUploaded(new Date(100));
961
        
962
        SystemMetadata p2Sys = new SystemMetadata();
963
        p2Sys.setIdentifier(p2);
964
        p2Sys.setSeriesId(s1);
965
        p2Sys.setObsoletes(p1);
966
        p2Sys.setObsoletedBy(p3);
967
        p2Sys.setDateUploaded(new Date(200));
968
        
969
        SystemMetadata p5Sys = new SystemMetadata();
970
        p5Sys.setIdentifier(p5);
971
        p5Sys.setSeriesId(s1);
972
        p5Sys.setObsoletes(p4);
973
        p5Sys.setDateUploaded(new Date(500));
974
        
975
 
976
        
977
        Vector<SystemMetadata> chain = new Vector<SystemMetadata>();
978
        chain.add(p1Sys);
979
        chain.add(p2Sys);
980
        chain.add(p5Sys);
981
        
982
        
983
        System.out.println("Case 18:");
984
        Identifier head = getHeadVersion(s1, chain);
985
        //System.out.println("The head is "+head.getValue());
986
        assertTrue(head.equals(p5));
987
      
988
    }
933 989
	
934 990
	
935 991
	/*

Also available in: Unified diff