Revision 5351
Added by berkley over 14 years ago
test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java | ||
---|---|---|
108 | 108 |
System.out.println("CST: creating document"); |
109 | 109 |
Identifier id = createDoc(token, getTestDoc()); |
110 | 110 |
System.out.println("CST: document created. Id: " + id.getValue()); |
111 |
|
|
111 | 112 |
//get the doc and sysmetadata |
112 | 113 |
System.out.println("CST: getting document with id " + id.getValue()); |
113 | 114 |
String gotDoc = getDoc(token, id); |
114 | 115 |
System.out.println("CST: getting sysmeta for doc with id " + id.getValue()); |
115 | 116 |
SystemMetadata sm = getSystemMetadata(token, id); |
117 |
|
|
116 | 118 |
//update the doc |
117 |
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ doing the update now $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"); |
|
118 | 119 |
gotDoc = gotDoc.replaceAll("XXX", "YYY"); |
119 | 120 |
System.out.println("CST: Changed test doc to " + gotDoc); |
120 | 121 |
Identifier newid = new Identifier(); |
121 | 122 |
newid.setValue(generateDocumentId()); |
122 |
System.out.println("CST: Generated newid " + newid); |
|
123 |
System.out.println("CST: Generated newid " + newid.getValue());
|
|
123 | 124 |
StringBufferInputStream sbis = new StringBufferInputStream(gotDoc); |
124 | 125 |
SystemMetadata newsm = createSystemMetadata(newid, gotDoc); |
125 |
System.out.println("CST: Created system metadata for new doc...updating.");
|
|
126 |
System.out.println("CST: Created system metadata for new doc...updating newid: " + newid.getValue() + " obsId: " + id.getValue());
|
|
126 | 127 |
Identifier updatedid = cs.update(token, newid, sbis, id, newsm); |
127 |
System.out.println("CST: Called update. Returned id " + id); |
|
128 |
System.out.println("CST: Called update. Returned id " + updatedid.getValue()); |
|
129 |
|
|
128 | 130 |
//get doc - check that it matches update |
129 | 131 |
String newdoc = getDoc(token, newid); |
130 | 132 |
assertTrue(gotDoc.equals(newdoc)); |
133 |
|
|
131 | 134 |
//get sysmeta - check that ids and other fields are updated |
135 |
System.out.println("CST: confirming obsoletedBy fields for sm doc with id " + id.getValue()); |
|
132 | 136 |
SystemMetadata newnewsm = getSystemMetadata(token, id); |
133 | 137 |
List obsoletedByList = newnewsm.getObsoletedByList(); |
134 | 138 |
assertTrue(obsoletedByList.size() == 1); |
135 | 139 |
String obsBy = ((Identifier)obsoletedByList.get(0)).getValue(); |
136 |
assertTrue(obsBy.equals(id.getValue())); |
|
140 |
System.out.println("CST: obsBy: " + obsBy); |
|
141 |
System.out.println("CST: id: " + id.getValue()); |
|
142 |
assertTrue(obsBy.equals(newid.getValue())); |
|
137 | 143 |
} |
138 | 144 |
catch(Exception e) |
139 | 145 |
{ |
Also available in: Unified diff
update works. it was the test that was faulty. all working now