Changeset 1487 for trunk/test
- Timestamp:
- Feb 3, 2011, 10:51:16 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/dbnp/query/StudySearchTests.groovy
r1478 r1487 5 5 import org.dbnp.gdt.AssayModule 6 6 import org.codehaus.groovy.grails.commons.ApplicationHolder 7 import dbnp.authentication.*; 7 8 8 9 /** … … 33 34 ] 34 35 def assays = [ new Assay( name: 'Assay 1', parent: studies[0], samples: [samples[0]] ), new Assay( name: 'Assay 2', parent: studies[1], samples: [samples[1]] ) ] 36 37 def users = [ new SecUser( username: "abc" ) ]; 35 38 36 39 mockDomain( Study, studies ); … … 42 45 43 46 mockDomain( AssayModule ); 47 mockDomain( SecUser, users ) 48 mockDomain( SecUserSecRole ) 49 mockDomain( SecRole ) 44 50 45 51 subjects.each { it.parent.addToSubjects( it ); } … … 49 55 samples.each { it.parent.addToSamples( it ); } 50 56 assays.each { it.parent.addToAssays( it ); } 57 studies.each { 58 it.owner = users[0] 59 } 51 60 52 61 // some mocks to make sure test doesn't break on finding 'moduleCommunicationService' 53 ApplicationHolder.metaClass.static.getApplication = { [getMainContext: { [getBean: {a -> null}] }] } 62 ApplicationHolder.metaClass.static.getApplication = { [getMainContext: 63 { [getBean: 64 { what -> 65 if( what == "authenticationService" ) 66 return [getLoggedInUser: { return users[0]; } ] 67 else if( what == "moduleCommunicationService" ) 68 return null 69 } 70 ] } 71 ] } 54 72 55 73 } … … 70 88 71 89 // Search without criteria 72 studySearch.setCriteria( 90 studySearch.setCriteria(); 73 91 studySearch.execute(); 74 92
Note: See TracChangeset
for help on using the changeset viewer.