Changeset 5072
- Timestamp:
- Aug 21, 2009, 9:07:59 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/test/TestChangeHistory.java
r5039 r5072 35 35 import net.sf.basedb.core.ItemResultList; 36 36 import net.sf.basedb.core.ProgressReporter; 37 import net.sf.basedb.core.Type; 37 38 import net.sf.basedb.core.User; 38 39 import net.sf.basedb.core.log.LogManagerFactory; … … 65 66 int bioSourceId = TestBioSource.test_create("Biosource 1", false); 66 67 int sampleId = TestSample.test_create(bioSourceId, "Sample 1", false); 68 int annotationTypeId = TestAnnotationType.test_create("change", Type.INT, 0, null, null, Item.SAMPLE, 1, null, false); 69 TestAnnotation.test_annotatate(Item.SAMPLE, sampleId, annotationTypeId, 0, 1); 70 TestAnnotation.test_annotatate(Item.SAMPLE, sampleId, annotationTypeId, 0, 2); 71 TestAnnotation.test_remove_annotation(Item.SAMPLE, sampleId, annotationTypeId); 67 72 int extractId = TestExtract.test_create(sampleId, false); 68 73 TestExtract.test_delete(extractId); 69 74 70 75 test_list_by_item(Item.BIOSOURCE, bioSourceId, 1); 71 test_list_by_user(TestUtil.getSessionControl().getLoggedInUserId(), since, 4); 76 test_list_by_item(Item.SAMPLE, sampleId, 6); 77 /* 78 Total change log events: 79 4 CREATE (biosource, sample, annotationtype, extract) 80 5 UPDATE (when adding, updating and removing the annotation from the sample) 81 1 DELETE (extract) 82 */ 83 test_list_by_user(TestUtil.getSessionControl().getLoggedInUserId(), since, 10); 72 84 73 85 if (TestUtil.waitBeforeDelete()) TestUtil.waitForEnter(); … … 75 87 TestSample.test_delete(sampleId); 76 88 TestBioSource.test_delete(bioSourceId); 77 test_delete_stray(6); 89 TestAnnotationType.test_delete(annotationTypeId); 90 test_delete_stray(13); 78 91 set_log_manager(old); 79 92 write("++Testing change history "+(ok ? "OK" : "Failed")+"\n"); … … 98 111 throw new BaseException("Expected "+expectedResults+" results, not "+l.size()); 99 112 } 100 write("--List history of itemOK ("+l.size()+")");113 write("--List history of " + item + " OK ("+l.size()+")"); 101 114 } 102 115 catch (Throwable ex) 103 116 { 104 write("--List history of itemFAILED");117 write("--List history of " + itemType + "[id=" + itemId + "] FAILED"); 105 118 ex.printStackTrace(); 106 119 ok = false; … … 160 173 throws BaseException 161 174 { 162 BasicItem item = null; 163 try 164 { 165 item = c.getItem(null); 175 String item = null; 176 try 177 { 178 BasicItem b = c.getItem(null); 179 item = b.toString(); 166 180 } 167 181 catch (ItemNotFoundException ex) 168 {} 182 { 183 item = c.getItemType() + "[id=" + c.getItemId() + "; not found]"; 184 } 169 185 if (!TestUtil.getSilent()) System.out.println(i+":\t"+c.getId()+"\t"+c.getTime()+"\t"+ 170 186 c.getChangeType() + "\t" + item + "\t" + c.getChangeInfo()+"\t"+c.getUser(null));
Note: See TracChangeset
for help on using the changeset viewer.