Changeset 7 for trunk/test


Ignore:
Timestamp:
Jan 26, 2011, 5:08:25 PM (9 years ago)
Author:
robert@…
Message:
  • Created tests for the synchronization and trash
  • Improved synchronizationservice and trash
  • Put authorization checks in several pages
Location:
trunk/test
Files:
7 added
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/nl/tno/metagenomics/integration/TrashControllerTests.groovy

    r6 r7  
    1 package metagenomics
     1package nl.tno.metagenomics.integration
     2
    23
    34import grails.test.*
  • trunk/test/unit/nl/tno/metagenomics/integration/TrashServiceTests.groovy

    r4 r7  
    5858                s.save(flush:true);
    5959               
     60                // Create a single run
     61                Run run = new Run( name: "abc" );
     62                run.save(flush:true);
     63               
    6064                // Create desired combinations of samples and assays
    6165                // Such that: assay1 has 2 samples with data, assay2 has 1 sample with data and assay3 has no samples with data
     
    6771           def assaySamples= [as1a, as1b, as2a, as2b, as3a]
    6872
    69            a1.addToAssaySamples( as1a ); sa1.addToAssaySamples( as1a );
     73           a1.addToAssaySamples( as1a ); sa1.addToAssaySamples( as1a ); run.addToAssaySamples( as1a );
    7074           as1a.save(flush:true);
    7175           
    72            a1.addToAssaySamples( as1b ); sa2.addToAssaySamples( as1b );
     76           a1.addToAssaySamples( as1b ); sa2.addToAssaySamples( as1b ); run.addToAssaySamples( as1b );
    7377           as1b.save(flush:true);
    7478
    75            a2.addToAssaySamples( as2a ); sa3.addToAssaySamples( as2a );
     79           a2.addToAssaySamples( as2a ); sa3.addToAssaySamples( as2a ); run.addToAssaySamples( as2a );
    7680           as2a.save(flush:true);
    7781
    78            a2.addToAssaySamples( as2b ); sa4.addToAssaySamples( as2b );
     82           a2.addToAssaySamples( as2b ); sa4.addToAssaySamples( as2b ); run.addToAssaySamples( as2b );
    7983           as2b.save(flush:true);
    8084
    81            a3.addToAssaySamples( as3a ); sa5.addToAssaySamples( as3a );
     85           a3.addToAssaySamples( as3a ); sa5.addToAssaySamples( as3a ); run.addToAssaySamples( as3a );
    8286           as3a.save(flush:true);
    8387           
     
    8791           assays.each { it.save(flush:true); }
    8892           samples.each { it.save(flush:true); }
    89            
    90            // Create a single run
    91            Run run = new Run( name: "abc" );
    9293           run.save(flush:true);
    93 
     94           
    9495           // Add sequencedata objects to as1a and as1b
    95            SequenceData sd1 = new SequenceData( run: run, assaySample: as1a, sequenceFile: "fasta1", qualityFile: "qual1", numSequences: 100, averageQuality: 10.0 );
    96            SequenceData sd2 = new SequenceData( run: run, assaySample: as1a, sequenceFile: "fasta2", qualityFile: "qual2", numSequences: 30, averageQuality: 14.0 );
    97            SequenceData sd3 = new SequenceData( run: run, assaySample: as1b, sequenceFile: "fasta3", qualityFile: "qual3", numSequences: 2000, averageQuality: 17.0 );
     96           SequenceData sd1 = new SequenceData( assaySample: as1a, sequenceFile: "fasta1", qualityFile: "qual1", numSequences: 100, averageQuality: 10.0 );
     97           SequenceData sd2 = new SequenceData( assaySample: as1a, sequenceFile: "fasta2", qualityFile: "qual2", numSequences: 30, averageQuality: 14.0 );
     98           SequenceData sd3 = new SequenceData( assaySample: as1b, sequenceFile: "fasta3", qualityFile: "qual3", numSequences: 2000, averageQuality: 17.0 );
    9899           def sequenceData = [sd1, sd2, sd3];
    99            
    100            run.addToSequenceData( sd1 );
    101            run.addToSequenceData( sd2 );
    102            run.addToSequenceData( sd3 );
    103100           
    104101           as1a.addToSequenceData( sd1 );
     
    106103           as1b.addToSequenceData( sd3 );
    107104           
    108            run.save(flush:true); as1a.save(flush:true); as1b.save(flush:true);
     105           as1a.save(flush:true); as1b.save(flush:true);
    109106           sequenceData.each { it.save(flush:true); }
    110107        }
     
    130127                trash.save(flush:true);
    131128               
    132                 // Create desired combinations of samples and assays
     129           // Create a single run in order to be able to save sequencedata
     130           Run run = new Run( name: "trashrun" );
     131           run.save(flush:true);
     132
     133                // Create desired combinations of samples and assays
    133134                // Such that: assay1 has 2 samples with data, assay2 has 1 sample with data and assay3 has no samples with data
    134135           AssaySample as1a = new AssaySample( id: 102, oligoNumber: "fromtrash: 1", tagSequence: "fromtrash: abc", sample: sa1, assay: a1 );
     
    137138           def assaySamples= [as1a, as1b, as2a]
    138139
    139            a1.addToAssaySamples( as1a ); sa1.addToAssaySamples( as1a );
     140           a1.addToAssaySamples( as1a ); sa1.addToAssaySamples( as1a ); run.addToAssaySamples( as1a );
    140141           as1a.save(flush:true);
    141142           
    142            a1.addToAssaySamples( as1b ); sa2.addToAssaySamples( as1b );
     143           a1.addToAssaySamples( as1b ); sa2.addToAssaySamples( as1b ); run.addToAssaySamples( as1b );
    143144           as1b.save(flush:true);
    144145
    145            a1.addToAssaySamples( as2a ); sa3.addToAssaySamples( as2a );
     146           a1.addToAssaySamples( as2a ); sa3.addToAssaySamples( as2a ); run.addToAssaySamples( as2a );
    146147           as2a.save(flush:true);
    147148
     
    149150           assays.each { it.save(flush:true); }
    150151           samples.each { it.save(flush:true); }
    151            
    152            // Create a single run in order to be able to save sequencedata
    153            Run run = new Run( name: "trashrun" );
    154            run.save(flush:true);
    155 
     152           run.save( flush:true );
     153           
    156154           // Add sequencedata objects to as1a and as1b
    157            SequenceData sd1 = new SequenceData( run: run, assaySample: as1a, sequenceFile: "fromtrash: fasta1", qualityFile: "fromtrash: qual1", numSequences: 80, averageQuality: 11.0 );
    158            SequenceData sd2 = new SequenceData( run: run, assaySample: as1a, sequenceFile: "fromtrash: fasta2", qualityFile: "fromtrash: qual2", numSequences: 520, averageQuality: 14.0 );
    159            SequenceData sd3 = new SequenceData( run: run, assaySample: as1b, sequenceFile: "fromtrash: fasta3", qualityFile: "fromtrash: qual3", numSequences: 2000, averageQuality: 17.0 );
     155           SequenceData sd1 = new SequenceData( assaySample: as1a, sequenceFile: "fromtrash: fasta1", qualityFile: "fromtrash: qual1", numSequences: 80, averageQuality: 11.0 );
     156           SequenceData sd2 = new SequenceData( assaySample: as1a, sequenceFile: "fromtrash: fasta2", qualityFile: "fromtrash: qual2", numSequences: 520, averageQuality: 14.0 );
     157           SequenceData sd3 = new SequenceData( assaySample: as1b, sequenceFile: "fromtrash: fasta3", qualityFile: "fromtrash: qual3", numSequences: 2000, averageQuality: 17.0 );
    160158           def sequenceData = [sd1, sd2, sd3];
    161            
    162            run.addToSequenceData( sd1 );
    163            run.addToSequenceData( sd2 );
    164            run.addToSequenceData( sd3 );
    165159           
    166160           as1a.addToSequenceData( sd1 );
     
    168162           as1b.addToSequenceData( sd3 );
    169163           
    170            run.save(flush:true); as1a.save(flush:true); as1b.save(flush:true);
     164           as1a.save(flush:true); as1b.save(flush:true);
    171165           sequenceData.each { it.save(flush:true); }
    172166        }
Note: See TracChangeset for help on using the changeset viewer.