Revision 9085
Added by Jing Tao almost 10 years ago
test/edu/ucsb/nceas/metacat/dataone/SIDTest.java | ||
---|---|---|
132 | 132 |
testCase12(); |
133 | 133 |
testCase13(); |
134 | 134 |
testCase14(); |
135 |
testCase15(); |
|
135 | 136 |
} |
136 | 137 |
|
137 | 138 |
/** |
... | ... | |
755 | 756 |
assertTrue(head.equals(p2)); |
756 | 757 |
} |
757 | 758 |
|
759 |
/** |
|
760 |
* case 15. P1(S1) <-> P2(S1) ?? <- P4(S1) <-> P5(S2), S1 = P2 (Rule 1) oops!, should be s1=P4 |
|
761 |
* @throws Exception |
|
762 |
*/ |
|
763 |
private void testCase15() throws Exception { |
|
764 |
Identifier s1 = new Identifier(); |
|
765 |
s1.setValue("S1"); |
|
766 |
Identifier s2 = new Identifier(); |
|
767 |
s2.setValue("S2"); |
|
768 |
Identifier p1 = new Identifier(); |
|
769 |
p1.setValue("P1"); |
|
770 |
Identifier p2 = new Identifier(); |
|
771 |
p2.setValue("P2"); |
|
772 |
Identifier p3 = new Identifier(); |
|
773 |
p3.setValue("P3"); |
|
774 |
Identifier p4 = new Identifier(); |
|
775 |
p4.setValue("P4"); |
|
776 |
Identifier p5 = new Identifier(); |
|
777 |
p5.setValue("P5"); |
|
778 |
|
|
779 |
SystemMetadata p1Sys = new SystemMetadata(); |
|
780 |
p1Sys.setIdentifier(p1); |
|
781 |
p1Sys.setSeriesId(s1); |
|
782 |
p1Sys.setObsoletedBy(p2); |
|
783 |
p1Sys.setDateUploaded(new Date(100)); |
|
784 |
|
|
785 |
SystemMetadata p2Sys = new SystemMetadata(); |
|
786 |
p2Sys.setIdentifier(p2); |
|
787 |
p2Sys.setSeriesId(s1); |
|
788 |
p2Sys.setObsoletes(p1); |
|
789 |
p2Sys.setDateUploaded(new Date(200)); |
|
790 |
|
|
791 |
SystemMetadata p4Sys = new SystemMetadata(); |
|
792 |
p4Sys.setIdentifier(p4); |
|
793 |
p4Sys.setSeriesId(s1); |
|
794 |
p4Sys.setObsoletes(p3); |
|
795 |
p4Sys.setObsoletedBy(p5); |
|
796 |
|
|
797 |
SystemMetadata p5Sys = new SystemMetadata(); |
|
798 |
p5Sys.setIdentifier(p5); |
|
799 |
p5Sys.setSeriesId(s2); |
|
800 |
p5Sys.setObsoletes(p4); |
|
801 |
|
|
802 |
|
|
803 |
Vector<SystemMetadata> chain = new Vector<SystemMetadata>(); |
|
804 |
chain.add(p1Sys); |
|
805 |
chain.add(p2Sys); |
|
806 |
chain.add(p4Sys); |
|
807 |
chain.add(p5Sys); |
|
808 |
|
|
809 |
System.out.println("Case 15:"); |
|
810 |
Identifier head = getHeadVersion(s1, chain); |
|
811 |
//System.out.println("The head is "+head.getValue()); |
|
812 |
assertTrue(head.equals(p4)); |
|
813 |
} |
|
758 | 814 |
|
815 |
|
|
759 | 816 |
/* |
760 | 817 |
* completed the obsoletes and obsoletedBy information for the given pid. |
761 | 818 |
* We will look up the information from the given chain if its obsoletes or obsoletedBy field is missing. |
Also available in: Unified diff
Add the case 15 refrence the page https://epad.dataone.org/pad/p/201501-MaintenanceStandup.