Changeset 966
- Timestamp:
- Oct 21, 2010, 3:54:12 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r965 r966 44 44 owner(nullable: true, blank: true) 45 45 code(nullable:false, blank:true,unique:true) 46 47 // TODO: add custom validator for 'published' to assess whether the study meets all quality criteria for publication 48 // tested by SampleTests.testStudyPublish 46 49 } 47 50 … … 360 363 } 361 364 362 // TODO: remove the sample from any assays it belongs to 365 // remove the sample from any assays it belongs to 366 this.assays.findAll { it.samples.any { it == sample }} .each { 367 println ".removed sample ${sample.name} from assay ${it.name}" 368 it.removeFromSamples(sample) 369 } 363 370 364 371 // Also here, contrary to documentation, an extra delete() is needed -
trunk/test/integration/gscf/SampleTests.groovy
r965 r966 112 112 } 113 113 114 private void addParentSubject() { 115 116 def sampleDB = Sample.findByName(testSampleName) 117 assert sampleDB 118 119 // Retrieve the parent study 120 def study = Study.findByTitle(testStudyName) 121 assert study 122 123 def subject = SubjectTests.createSubject(study) 124 assert subject 125 126 sampleDB.parentSubject = subject 127 assert sampleDB.validate() 128 assert sampleDB.save() 129 130 } 131 132 /** 133 * Test whether a study which has orphan (without parent subject/event) samples cannot be published 134 */ 114 135 void testStudyPublish() { 115 136 def sampleDB = Sample.findByName(testSampleName) … … 124 145 125 146 // Try to publish the study, should fail as it has a sample without a parent sampling event 126 //study.published = true147 study.published = true 127 148 assert !study.validate() 128 149 … … 131 152 132 153 // Add parent subject 154 addParentSubject() 133 155 134 156 // Now the study should validate … … 184 206 assert study 185 207 186 def subject = SubjectTests.createSubject(study) 187 assert subject 188 189 sampleDB.parentSubject = subject 190 assert sampleDB.validate() 191 assert sampleDB.save() 208 // Add parent subject 209 addParentSubject() 210 Subject subject = sampleDB.parentSubject 192 211 193 212 // Use the deleteSubject method … … 250 269 assert event 251 270 252 // Create a subject and add it at the sample's parent 253 def subject = SubjectTests.createSubject(study) 254 assert subject 255 sampleDB.parentSubject = subject 256 assert sampleDB.validate() 257 assert sampleDB.save() 258 259 // Create an event group in this study with the sample's sampling event 271 // Add parent subject 272 addParentSubject() 273 Subject subject = sampleDB.parentSubject 274 275 // Create an event group in this study with the sample's sampling event and subject 260 276 def group = new EventGroup( 261 277 name: testEventGroupName … … 264 280 assert group.validate() 265 281 266 267 282 group.addToSubjects(subject) 268 283 group.addToSamplingEvents(event) 284 269 285 assert study.eventGroups.find { it.name == group.name} 270 286 assert group.validate()
Note: See TracChangeset
for help on using the changeset viewer.