← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1870: Improved DhisTest

 

------------------------------------------------------------
revno: 1870
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Mon 2010-05-17 23:54:30 +0200
message:
  Improved DhisTest
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java
  dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java
  dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/importobject/ImportObjectServiceImportAllTest.java
  dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisTest.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 14:19:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 21:54:30 +0000
@@ -697,7 +697,8 @@
     class="org.hisp.dhis.dataentryform.DataEntryFormPopulator">
   	<property name="jdbcTemplate" ref="jdbcTemplate"/>
   	<property name="statementBuilder" ref="statementBuilder"/>
-    <property name="runlevel" value="1"/>
+    <property name="runlevel" value="1"/> 
+    <property name="skipInTests" value="true"/>
   </bean>
 	
   <bean id="org.hisp.dhis.period.PeriodTypePopulator"
@@ -747,7 +748,8 @@
   <bean id="org.hisp.dhis.organisationunit.OrganisationUnitHierarchyVerifier"
     class="org.hisp.dhis.organisationunit.OrganisationUnitHierarchyVerifier">
     <property name="organisationUnitService"
-      ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/>
+      ref="org.hisp.dhis.organisationunit.OrganisationUnitService"/> 
+    <property name="skipInTests" value="true"/>
   </bean>
   
   <bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupSetPopulator"

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java	2010-05-17 19:31:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java	2010-05-17 21:54:30 +0000
@@ -40,7 +40,6 @@
 import java.util.List;
 
 import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dbms.DbmsManager;
 import org.junit.Test;
 
 /**
@@ -54,8 +53,6 @@
 
     private OrganisationUnitGroupService organisationUnitGroupService;
     
-    private DbmsManager dbmsManager;
-
     @Override
     public void setUpTest()
         throws Exception
@@ -65,8 +62,6 @@
         organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID );
         
         organisationUnitService.removeOrganisationUnitHierarchies( OrganisationUnitHierarchyVerifier.START_OF_TIME );
-
-        dbmsManager = (DbmsManager) getBean( DbmsManager.ID );
     }
 
     // -------------------------------------------------------------------------
@@ -941,24 +936,4 @@
         assertNull( organisationUnitService.getOrganisationUnitLevel( idA ) );
         assertNull( organisationUnitService.getOrganisationUnitLevel( idB ) );        
     }
-
-    @Test
-    public void testRemoveOrganisationUnitLevels()
-    {
-        OrganisationUnitLevel levelA = new OrganisationUnitLevel( 1, "National" );
-        OrganisationUnitLevel levelB = new OrganisationUnitLevel( 2, "District" );
-        
-        int idA = organisationUnitService.addOrganisationUnitLevel( levelA );
-        int idB = organisationUnitService.addOrganisationUnitLevel( levelB );
-
-        assertNotNull( organisationUnitService.getOrganisationUnitLevel( idA ) );
-        assertNotNull( organisationUnitService.getOrganisationUnitLevel( idB ) );
-        
-        organisationUnitService.deleteOrganisationUnitLevels();
-        
-        dbmsManager.clearSession();
-
-        assertNull( organisationUnitService.getOrganisationUnitLevel( idA ) );
-        assertNull( organisationUnitService.getOrganisationUnitLevel( idB ) ); 
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java	2010-05-17 21:54:30 +0000
@@ -35,7 +35,6 @@
 import java.util.Collection;
 
 import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dbms.DbmsManager;
 import org.junit.Test;
 
 /**
@@ -47,14 +46,10 @@
 {
     private OrganisationUnitStore organisationUnitStore;
     
-    private DbmsManager dbmsManager;
-    
     @Override
     public void setUpTest()
     {
         organisationUnitStore = (OrganisationUnitStore) getBean( OrganisationUnitStore.ID );
-        
-        dbmsManager = (DbmsManager) getBean( DbmsManager.ID );
     }
     
     // -------------------------------------------------------------------------
@@ -113,24 +108,4 @@
         assertNull( organisationUnitStore.getOrganisationUnitLevel( idA ) );
         assertNull( organisationUnitStore.getOrganisationUnitLevel( idB ) );        
     }
-
-    @Test
-    public void testRemoveOrganisationUnitLevels()
-    {
-        OrganisationUnitLevel levelA = new OrganisationUnitLevel( 1, "National" );
-        OrganisationUnitLevel levelB = new OrganisationUnitLevel( 2, "District" );
-        
-        int idA = organisationUnitStore.addOrganisationUnitLevel( levelA );
-        int idB = organisationUnitStore.addOrganisationUnitLevel( levelB );
-
-        assertNotNull( organisationUnitStore.getOrganisationUnitLevel( idA ) );
-        assertNotNull( organisationUnitStore.getOrganisationUnitLevel( idB ) );
-        
-        organisationUnitStore.deleteOrganisationUnitLevels();
-        
-        dbmsManager.clearSession();
-
-        assertNull( organisationUnitStore.getOrganisationUnitLevel( idA ) );
-        assertNull( organisationUnitStore.getOrganisationUnitLevel( idB ) ); 
-    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java	2010-05-17 21:05:26 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java	2010-05-17 21:54:30 +0000
@@ -45,7 +45,6 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.dbms.DbmsManager;
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.external.location.LocationManager;
 import org.hisp.dhis.external.location.LocationManagerException;
@@ -142,6 +141,7 @@
     // -------------------------------------------------------------------------
     // Fixture
     // -------------------------------------------------------------------------
+    
     @Override
     public void setUpTest() throws LocationManagerException, IOException
     {
@@ -188,8 +188,6 @@
 
         importDataValueService = (ImportDataValueService) getBean( ImportDataValueService.ID );
 
-        dbmsManager = (DbmsManager) getBean( DbmsManager.ID );
-
         setExternalTestDir( locationManager );
 
         // horrible hack to copy some files into external test dir

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/importobject/ImportObjectServiceImportAllTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/importobject/ImportObjectServiceImportAllTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/importobject/ImportObjectServiceImportAllTest.java	2010-05-17 21:54:30 +0000
@@ -47,7 +47,6 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.dbms.DbmsManager;
 import org.hisp.dhis.importexport.GroupMemberAssociation;
 import org.hisp.dhis.importexport.GroupMemberType;
 import org.hisp.dhis.importexport.ImportDataValue;
@@ -74,8 +73,6 @@
     
     private BatchHandlerFactory batchHandlerFactory;
     
-    private DbmsManager dbmsManager;
-
     // -------------------------------------------------------------------------
     // CategoryOption
     // -------------------------------------------------------------------------
@@ -248,8 +245,6 @@
         
         batchHandlerFactory = (BatchHandlerFactory) getBean( "batchHandlerFactory" );
         
-        dbmsManager = (DbmsManager) getBean( DbmsManager.ID );
-        
         dataElementService = (DataElementService) getBean( DataElementService.ID );
         
         categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 21:31:03 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/META-INF/dhis/beans.xml	2010-05-17 21:54:30 +0000
@@ -67,7 +67,7 @@
       
   <!-- Dbms -->
   
-  <bean id="org.hisp.dhis.dbms.DbmsManager"
+  <bean id="dbmsManager"
     class="org.hisp.dhis.dbms.HibernateDbmsManager">
     <property name="jdbcTemplate" ref="jdbcTemplate"/>
     <property name="sessionFactory" ref="sessionFactory"/>

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2010-05-17 21:05:26 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2010-05-17 21:54:30 +0000
@@ -54,7 +54,6 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.dbms.DbmsManager;
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.external.location.LocationManager;
@@ -137,8 +136,6 @@
 
     protected MappingService mappingService;
 
-    protected DbmsManager dbmsManager;
-
     protected ProgramStageService programStageService;
 
     static

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisTest.java	2010-05-17 19:31:07 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisTest.java	2010-05-17 21:54:30 +0000
@@ -35,6 +35,7 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.orm.hibernate3.SessionFactoryUtils;
@@ -52,12 +53,15 @@
 public abstract class DhisTest
     extends DhisConvenienceTest implements ApplicationContextAware
 {
+    @Autowired
+    protected DbmsManager dbmsManager;
+    
     // -------------------------------------------------------------------------
     // ApplicationContextAware implementation
     // -------------------------------------------------------------------------
 
     private ApplicationContext context;
-
+    
     public void setApplicationContext( ApplicationContext context )
     {
         this.context = context;
@@ -84,7 +88,7 @@
         
         if ( emptyDatabaseAfterTest() )
         {
-            DbmsManager dbmsManager = (DbmsManager) getBean( DbmsManager.ID );
+            //DbmsManager dbmsManager = (DbmsManager) getBean( DbmsManager.ID );
                         
             dbmsManager.emptyDatabase();
         }