Changeset 1473


Ignore:
Timestamp:
Feb 2, 2011, 11:54:51 AM (6 years ago)
Author:
s.h.sikkema@…
Message:

Fixed tests and removed obsolete ones so grails test-app works with all tests passed

Location:
trunk
Files:
5 deleted
6 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/query/SimpleQueryController.groovy

    r1430 r1473  
    242242   static List merge (List list1, List list2) {
    243243
    244      def resultList = []
    245      resultList = list1.intersect(list2)
    246 
    247      return resultList
     244     list1.intersect(list2)
     245
    248246   }
    249247
  • trunk/src/groovy/dbnp/query/Search.groovy

    r1458 r1473  
    4242        public void setResultFields( Map r ) { resultFields = r; }
    4343
     44    def moduleCommunicationService
     45
    4446        /**
    4547         * Returns the number of results found by this search
     
    206208                        return [];
    207209                       
    208                 // Determine the moduleCommunicationService
    209                 ApplicationContext ctx = (ApplicationContext)ApplicationHolder.getApplication().getMainContext();
    210                 def moduleCommunicationService = ctx.getBean("moduleCommunicationService");
     210//              // Determine the moduleCommunicationService
     211//              ApplicationContext ctx = (ApplicationContext)ApplicationHolder.getApplication().getMainContext();
     212//              def moduleCommunicationService = ctx.getBean("moduleCommunicationService");
    211213                       
    212214                // Loop through all modules and check whether criteria have been given
  • trunk/test/unit/dbnp/query/CriterionTests.groovy

    r1456 r1473  
    22
    33import grails.test.*
     4import org.dbnp.gdt.RelTime
    45
    56/**
  • trunk/test/unit/dbnp/query/SearchTests.groovy

    r1456 r1473  
    22
    33import grails.test.*
     4import org.dbnp.gdt.TemplateFieldType
     5import org.dbnp.gdt.RelTime
    46
    57/**
  • trunk/test/unit/dbnp/query/SimpleQueryControllerTests.groovy

    r1469 r1473  
    1 package dbnp.studycapturing
     1package dbnp.query
    22
    33import grails.test.ControllerUnitTestCase
    4 import dbnp.query.SimpleQueryController
    54
    65/**
     
    2524      def list2 = [1, 3, 5]
    2625
    27       def list3 = SimpleQueryController.mergeLists(list1, list2)
     26      def list3 = SimpleQueryController.merge(list1, list2)
    2827
    2928      assert list3 == [1, 3]
  • trunk/test/unit/dbnp/query/StudySearchTests.groovy

    r1430 r1473  
    33import dbnp.studycapturing.*
    44import grails.test.*
     5import org.dbnp.gdt.AssayModule
    56
    67/**
     
    3839                mockDomain( SamplingEvent, samplingEvents);
    3940                mockDomain( Assay, assays );
     41
     42        mockDomain( AssayModule );
    4043               
    4144                subjects.each { it.parent.addToSubjects( it ); }
  • trunk/test/unit/dbnp/studycapturing/AssayServiceTests.groovy

    r1456 r1473  
    6161        Subject.get(2).setFieldValue('tf3', 'tfv3')
    6262
    63         // mock authentication service
     63        // mock authenticationService
    6464        service.authenticationService = [
    6565                isLoggedIn: { true },
     
    6969        ]
    7070
     71        // mock moduleCommunicationService
     72        service.moduleCommunicationService = [
     73                isModuleReachable: { a -> true },
     74                callModuleRestMethodJSON: { consumer, path ->
     75                    [['sample1', 'sample2', 'sample3'],
     76                     ['measurement1','measurement2','measurement3','measurement4'],
     77                     [1,2,3,4,5,6,7,8,9,10,11,12] ]
     78                }
     79        ]
     80
    7181    }
    7282
     
    181191        def consumer = 'http://metabolomics.nmcdsp.nl'
    182192
    183         // mock URL's getText to be able to mock a http request
    184         URL.metaClass.getText = {
    185             new JSON ([['sample1', 'sample2', 'sample3'],
    186               ['measurement1','measurement2','measurement3','measurement4'],
    187               [1,2,3,4,5,6,7,8,9,10,11,12] ]).toString()
    188         }
     193//        // mock URL's getText to be able to mock a http request
     194//        URL.metaClass.getText = {
     195//            new JSON ([['sample1', 'sample2', 'sample3'],
     196//              ['measurement1','measurement2','measurement3','measurement4'],
     197//              [1,2,3,4,5,6,7,8,9,10,11,12] ]).toString()
     198//        }
    189199
    190200        def assayData = service.collectAssayData(assay, consumer)
     201
     202        println assayData
    191203
    192204        def sample1index = assayData.'Sample Data'.'name'.findIndexOf{it == 'sample1'}
  • trunk/test/unit/dbnp/studycapturing/StudyWizardControllerTests.groovy

    r1469 r1473  
    33import grails.test.*
    44
    5 class WizardControllerTests extends ControllerUnitTestCase {
     5class StudyWizardControllerTests extends ControllerUnitTestCase {
    66    protected void setUp() {
    77        super.setUp()
     
    1515        // Without parameters, the method should give an error
    1616        controller.ajaxParseRelTime();
    17         assert controller.response.status == 400;
     17            assert controller.response.status == 400;
    1818    }
    1919
     
    2222        controller.params.reltime = '';
    2323        controller.ajaxParseRelTime();
    24         assert controller.response.status == 200
    25         assert controller.response.contentAsString == ""
     24            assert controller.response.status == 200
     25        assert controller.response.contentAsString == "0 seconds"
    2626    }
    2727
     
    3030        controller.params.reltime = '3d';
    3131        controller.ajaxParseRelTime();
    32         assert controller.response.status == 200
     32            assert controller.response.status == 200
    3333        assert controller.response.contentAsString == "3 days"
    3434    }
     
    3838        controller.params.reltime = 'no valid reltime';
    3939        controller.ajaxParseRelTime();
    40         assert controller.response.status == 400;
     40        assert controller.response.status == 400;
    4141    }
    4242
Note: See TracChangeset for help on using the changeset viewer.