• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.server
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Change
  • Next Change →

Changeset 109 for branches/omero

Show
Ignore:
Timestamp:
06/13/05 17:12:24 (4 years ago)
Author:
jmoore
Message:

*) DBUnit working well now. Need to implement similar
*) TestFilter? in maven.xml needs some work. Coming

Location:
branches/omero
Files:
7 modified

  • components/client/.springBeans (modified) (1 diff)
  • components/server/.springBeans (modified) (2 diffs)
  • components/server/src/org/openmicroscopy/omero/logic/queries.hbm.xml (modified) (6 diffs)
  • components/server/test/org/openmicroscopy/omero/server/utests/HierarchyBrowsingDbUnitTest.java (modified) (5 diffs)
  • components/test/src/org/openmicroscopy/omero/test/OmeroGrinderTest.java (modified) (1 diff)
  • maven.xml (modified) (1 diff)
  • project.properties (modified) (1 diff)

Legend:

Unmodified
Added
Removed
  • branches/omero/components/client/.springBeans

    r108 r109  
    77        </configs> 
    88        <configSets> 
     9                <configSet> 
     10                        <name>client testing</name> 
     11                        <allowBeanDefinitionOverriding>false</allowBeanDefinitionOverriding> 
     12                        <incomplete>false</incomplete> 
     13                        <configs> 
     14                                <config>src/org/openmicroscopy/omero/client/spring.xml</config> 
     15                                <config>test/org/openmicroscopy/omero/client/itests/data.xml</config> 
     16                                <config>test/org/openmicroscopy/omero/client/itests/test.xml</config> 
     17                        </configs> 
     18                </configSet> 
    919        </configSets> 
    1020</beansProjectDescription> 
  • branches/omero/components/server/.springBeans

    r99 r109  
    77                <config>web/WEB-INF/config.xml</config> 
    88                <config>web/WEB-INF/facade-servlet.xml</config> 
    9                 <config>web/WEB-INF/config-test.xml</config> 
    109                <config>web/WEB-INF/dao.xml</config> 
    1110        </configs> 
    … …  
    1716                        <configs> 
    1817                                <config>web/WEB-INF/config.xml</config> 
    19                                 <config>web/WEB-INF/config-test.xml</config> 
    2018                                <config>web/WEB-INF/dao.xml</config> 
    2119                                <config>web/WEB-INF/data.xml</config> 
  • branches/omero/components/server/src/org/openmicroscopy/omero/logic/queries.hbm.xml

    r106 r109  
    8181          left outer join fetch cg_mex.experimenter as cg_exp 
    8282            where i in (:img_list) 
    83               and cla.valid = true 
     83              and ( cla.valid = true or cla.valid is null) 
     84                  ALSO NEED VALID STATEMENTS ON OTHER CLA QUERIES ABOVE!!! 
    8485  ]]></query>    
    8586  --> 
    … …  
    8889          left outer join fetch i.classifications as cla  
    8990            where i in (:img_list) 
    90               and cla.valid = true 
     91              and ( cla.valid = true or cla.valid is null) 
    9192  ]]></query>                      
    9293                   
    … …  
    9899          left outer join fetch ann_mex.experimenter as ann_exp 
    99100          where ann.image in (:img_list)  
    100             and ann.valid = true 
     101            and ( ann.valid = true or ann.valid is null) 
    101102  ]]></query> 
    102103 
    … …  
    107108          left outer join fetch ann_mex.experimenter as ann_exp 
    108109          where ann.image in (:img_list)  
    109             and ann.valid = true 
     110            and ( ann.valid = true or ann.valid is null) 
    110111            and ann_exp = :expId 
    111112  ]]></query> 
    … …  
    117118          left outer join fetch ann_mex.experimenter as ann_exp 
    118119      where ann.dataset in (:ds_list) 
    119             and ann.valid = true 
     120            and ( ann.valid = true or ann.valid is null) 
    120121  ]]></query> 
    121122   
    … …  
    126127          left outer join fetch ann_mex.experimenter as ann_exp 
    127128      where d in (:ds_list)  
    128             and ann.valid = true 
     129            and ( ann.valid = true or ann.valid is null) 
    129130            and ann_exp = :expId 
    130131  ]]></query> 
  • branches/omero/components/server/test/org/openmicroscopy/omero/server/utests/HierarchyBrowsingDbUnitTest.java

    r107 r109  
    66import java.io.FileInputStream; 
    77import java.util.ArrayList; 
     8import java.util.HashSet; 
     9import java.util.Iterator; 
    810import java.util.List; 
     11import java.util.Set; 
    912 
    1013import javax.sql.DataSource; 
    … …  
    2528import org.springframework.test.AbstractSpringContextTests; 
    2629 
     30import org.openmicroscopy.omero.logic.AnnotationDao; 
     31import org.openmicroscopy.omero.logic.ContainerDao; 
     32import org.openmicroscopy.omero.logic.Utils; 
    2733import org.openmicroscopy.omero.model.DatasetAnnotation; 
     34import org.openmicroscopy.omero.model.Image; 
    2835 
    2936/** 
    … …  
    3239public class HierarchyBrowsingDbUnitTest extends AbstractSpringContextTests { 
    3340 
     41    static IDatabaseConnection c = null; 
    3442    ApplicationContext ctx; 
    35     DataSource ds; 
    36     static IDatabaseConnection c = null; 
    37  
     43    DataSource ds = null; 
     44    ContainerDao cdao = null; 
     45    AnnotationDao adao = null; 
     46     
    3847    public static void main(String[] args) { 
    3948        junit.textui.TestRunner.run(HierarchyBrowsingDbUnitTest.class); 
    … …  
    5564    protected void setUp() throws Exception { 
    5665        ctx = getContext(getConfigLocations()); 
    57          
    58         if (null==ds){ 
     66      
     67        if (null == cdao || null == adao || null == ds) { 
     68            cdao = (ContainerDao) ctx.getBean("containerDao"); 
     69            adao = (AnnotationDao) ctx.getBean("annotationDao"); 
    5970            ds = (DataSource) ctx.getBean("dataSource"); 
    6071        } 
    … …  
    7182    } 
    7283 
    73     public void testFindDSAnnWithId() { 
     84    public void testFindPDIHierarchies(){ 
     85        Set set = getSetFromInt(new int[]{1,5,6,7,8,9,0}); 
     86        List result = cdao.findPDIHierarchies(set); 
     87        assertTrue("Should have found all the images but Zero", result.size()==set.size()+1); 
     88        for (Iterator i = result.iterator(); i.hasNext();) { 
     89            Image img = (Image) i.next(); 
     90            assertTrue("Fully initialized",Hibernate.isInitialized(img.getDatasets())); 
     91        }         
     92    } 
     93     
     94    public void testFindDSAnn() { 
    7495        // Use filter sets to DRY 
    75         SessionFactory sf = (SessionFactory) ctx.getBean("sessionFactory"); // TODO put in spring 
    76         HibernateTemplate ht = new HibernateTemplate(sf); 
    77         List result = ht.executeFind(new HibernateCallback() { 
    78             public Object doInHibernate(Session session) 
    79                     throws HibernateException { 
    80                 List l = new ArrayList(); 
    81                 l.add(new Integer(120)); 
    82                 Query q = session.getNamedQuery("findDatasetAnnWithID"); 
    83                 q.setParameterList("ds_list",l); 
    84                 q.setLong("expId",286035); 
    85                 return q.list(); 
    86             } 
    87         }); 
    88          
     96        Set set = new HashSet(); 
     97        set.add(new Integer(120)); 
     98        int experimenter = 286033; 
     99        testDsResult(adao.findDataListAnnotationForExperimenter(set,experimenter)); 
     100        testDsResult(adao.findDataListAnnotations(set)); 
     101    } 
     102  
     103    void testDsResult(List result){ 
    89104        assertTrue("This should be the only known DS annotation",result.size()==1); 
    90105        DatasetAnnotation ann = (DatasetAnnotation) result.get(0); 
    91106        assertTrue("Attribute id is also known.", ann.getAttributeId().intValue()==320101); 
    92107        assertTrue("Mex should be fetched.",Hibernate.isInitialized(ann.getModuleExecution())); 
    93          
     108    } 
     109     
     110    public void testFindImageAnn(){ 
     111        Set set = new HashSet(); 
     112        //select a.image_id, m.experimenter_id from module_executions m, image_annotations a where a.module_execution_id = m.module_execution_id; 
     113        //images{1,27, 313,36,42, 7,41, 357, 296,11,26,28,39,31, 485, 558,25,24, 340,4391,4446,4507, 8, 1,22}; 
     114        //users 
     115        set.add(new Integer(1)); 
     116        set.add(new Integer(27)); 
     117        set.add(new Integer(313)); 
     118        int experimenter = 1; 
     119        List r1 = adao.findImageAnnotations(set); 
     120        List r2 = adao.findImageAnnotationsForExperimenter(set,experimenter); 
     121        assertTrue("The user filtered list should be smaller", r2.size() < r1.size()); 
     122    } 
     123     
     124    Set getSetFromInt(int[] ids){ 
     125        Set set = new HashSet(); 
     126        for (int i = 0; i < ids.length; i++) { 
     127            set.add(new Integer(ids[i])); 
     128        } 
     129        return set; 
    94130    } 
    95131} 
  • branches/omero/components/test/src/org/openmicroscopy/omero/test/OmeroGrinderTest.java

    r108 r109  
    6666        return new String[] {  
    6767                "org/openmicroscopy/omero/client/spring.xml", 
    68                 "org/openmicroscopy/omero/client/itests/data.xml" }; 
     68                "org/openmicroscopy/omero/client/itests/data.xml", 
     69                "org/openmicroscopy/omero/client/itests/test.xml"}; 
    6970    } 
    7071 
  • branches/omero/maven.xml

    r108 r109  
    3939     <ant:delete file="${basedir}/src/spring.properties"/> 
    4040   </preGoal>  
     41   <goal name="test"> 
     42     <maven:property name="goal" defaultValue="test:test" /> 
     43     <attainGoal name="multiproject:goal"/> 
     44   </goal> 
    4145 
    4246<!-- Setup -->  
  • branches/omero/project.properties

    r100 r109  
    66maven.test.mode=unit 
    77test.unit.includes = **/utests/** 
    8 test.unit.excludes = **/itests/** 
     8test.unit.excludes = **/itests/**,**/test** 
    99test.integration.includes = **/itests/** 
    10 test.integration.excludes = **/utests/** 
     10test.integration.excludes = **/utests/**,**/test/** 
    1111 
    1212 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/