Changeset 1882


Ignore:
Timestamp:
May 25, 2011, 5:27:45 PM (8 years ago)
Author:
s.h.sikkema@…
Message:

Fixed an assayService unit test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/dbnp/studycapturing/AssayServiceTests.groovy

    r1830 r1882  
    5656                                    new EventGroup(id:2, name: 'EventGroup2', events: [Event.get(2)], samplingEvents: [SamplingEvent.get(2)])])
    5757
    58         mockDomain(Sample,        [ new Sample(id: 1, name:'sample1', parentSubject: Subject.get(1), parentEvent: SamplingEvent.get(1), parentEventGroup: EventGroup.get(1)),
    59                                     new Sample(id: 2, name:'sample2', parentSubject: Subject.get(2), parentEvent: SamplingEvent.get(2), parentEventGroup: EventGroup.get(2))])
     58        mockDomain(Sample,        [ new Sample(id: 1, name:'sample1', parentSubject: Subject.get(1), parentEvent: SamplingEvent.get(1), parentEventGroup: EventGroup.get(1), sampleUUID: 'uuid1'),
     59                                    new Sample(id: 2, name:'sample2', parentSubject: Subject.get(2), parentEvent: SamplingEvent.get(2), parentEventGroup: EventGroup.get(2), sampleUUID: 'uuid2'),
     60                                    new Sample(id: 3, name:'sample3', parentSubject: Subject.get(2), parentEvent: SamplingEvent.get(2), parentEventGroup: EventGroup.get(2), sampleUUID: 'uuid3')])
    6061
    6162        mockDomain(AssayModule,   [ new AssayModule(id: 1, url: 'http://www.example.com') ])
    6263
    63         mockDomain(Assay,         [ new Assay(id: 1, module: AssayModule.get(1), samples: [Sample.get(1),Sample.get(2)]),
     64        mockDomain(Assay,         [ new Assay(id: 1, module: AssayModule.get(1), samples: [Sample.get(1),Sample.get(2), Sample.get(3)]),
    6465                                    new Assay(id: 2, module: AssayModule.get(1), samples: [])])
    6566
     
    8182        service.moduleCommunicationService = [
    8283                isModuleReachable: { a -> true },
    83                 callModuleRestMethodJSON: { consumer, path ->
    84                     [['sample1', 'sample2', 'sample3'],
     84                callModuleMethod: { consumer, path, c, d ->
     85                    [['uuid1', 'uuid2', 'uuid3'],
    8586                     ['measurement1','measurement2','measurement3','measurement4'],
    8687                     [1,2,3,4,5,6,7,8,9,10,11,12] ]
     
    198199        def assay = Assay.get(1)
    199200
    200 
    201 //        collectAssayData(assay, fieldMap, measurementTokens)
    202 
    203201        def fieldMap = [
    204                 'Subject Data':[[name:'tf1'],[name:'tf2'],[name:'tf3'],[name:'species'],[name:'name']],
    205                 'Sampling Event Data':[[name:'startTime'],[name:'duration']],
    206                 'Sample Data':[[name:'name']],
    207                 'Event Group':[[name:'name']]
    208         ]
    209 
    210         def measurementTokens = [[name:'measurement1'], [name:'measurement2'], [name:'measurement3'], [name:'measurement4']]
     202                'Subject Data':[[name:'tf1', displayName: 'tf1'],[name:'tf2', displayName: 'tf2'],[name:'tf3', displayName: 'tf3'],[name:'species', displayName: 'species'],[name:'name', displayName: 'name']],
     203                'Sampling Event Data':[[name:'startTime', displayName: 'startTime'],[name:'duration', displayName: 'duration']],
     204                'Sample Data':[[name:'name', displayName: 'name']],
     205                'Event Group':[[name:'name', displayName: 'name']]
     206        ]
     207
     208        def measurementTokens = ['measurement1', 'measurement2', 'measurement3', 'measurement4']
    211209
    212210        String.metaClass.'encodeAsURL' = {delegate}
     
    220218        assertEquals 'Subject template field', ['tfv2',''], assayData.'Subject Data'.tf2[sample1index, sample2index]
    221219        assertEquals 'Subject template field', ['','tfv3'], assayData.'Subject Data'.tf3[sample1index, sample2index]
    222         assertEquals 'Subject species template field', ['Human', 'Human'], assayData.'Subject Data'.species*.toString()
     220        assertEquals 'Subject species template field', ['Human', 'Human', 'Human'], assayData.'Subject Data'.species*.toString()
    223221        assertEquals 'Subject name template field', ['subject1','subject2'], assayData.'Subject Data'.name[sample1index, sample2index]
    224222
    225         assertEquals 'Sampling event template fields', [2,12], assayData.'Sampling Event Data'.startTime[sample1index, sample2index]
    226         assertEquals 'Sampling event template fields', [5,15], assayData.'Sampling Event Data'.duration[sample1index, sample2index]
     223        assertEquals 'Sampling event template fields', ['2s','12s'], assayData.'Sampling Event Data'.startTime[sample1index, sample2index]
     224        assertEquals 'Sampling event template fields', ['5s','15s'], assayData.'Sampling Event Data'.duration[sample1index, sample2index]
    227225//        assertEquals 'Sampling event template fields', '[null, null]', assayData.'Sampling Event Data'.sampleTemplate.toString()
    228226        assertEquals 'Sample template fields', ['sample1', 'sample2'], assayData.'Sample Data'.name[sample1index, sample2index]
     
    230228        assertEquals 'Event group names', ['EventGroup1', 'EventGroup2'], assayData.'Event Group'.name[sample1index, sample2index]
    231229
    232         assertEquals 'Module Measurement Data', ['measurement1': [1,5,9], 'measurement2': [2,6,10], 'measurement3': [3,7,11], 'measurement4': [4,8,12]], assayData.'Module Measurement Data'
     230        assertEquals 'Module Measurement Data', ['measurement1': [1,2,3], 'measurement2': [4,5,6], 'measurement3': [7,8,9], 'measurement4': [10,11,12]], assayData.'Module Measurement Data'
    233231    }
    234232
Note: See TracChangeset for help on using the changeset viewer.