← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15033: Various test fixes in dhis-service-core

 

------------------------------------------------------------
revno: 15033
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-04-27 23:28:37 +0200
message:
  Various test fixes in dhis-service-core
removed:
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/SectionStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/option/OptionServiceTest.java
  dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.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-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2014-04-18 07:35:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2014-04-27 21:28:37 +0000
@@ -58,7 +58,7 @@
      * @param organisationUnit the OrganisationUnit to add.
      * @return a generated unique id of the added OrganisationUnit.
      */
-    public int addOrganisationUnit( OrganisationUnit organisationUnit );
+    int addOrganisationUnit( OrganisationUnit organisationUnit );
 
     /**
      * Updates an OrganisationUnit.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/SectionStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/SectionStoreTest.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/SectionStoreTest.java	2014-04-27 21:28:37 +0000
@@ -82,12 +82,12 @@
         dataElements.add( dataElementA );
         dataElements.add( dataElementB );
 
-        Set<DataElementOperand> operands = new HashSet<DataElementOperand>( categoryService.getOperands( dataElements ) );
-        
+        Set<DataElementOperand> operands = new HashSet<DataElementOperand>();
+        operands.add( new DataElementOperand( dataElementA, categoryCombo.getOptionCombos().iterator().next() ) );
+                
         sectionA = new Section( "SectionA", dataSet, dataElements, operands );
         sectionB = new Section( "SectionB", dataSet, dataElements, operands );
-        sectionC = new Section( "SectionC", dataSet, dataElements, operands );
-        
+        sectionC = new Section( "SectionC", dataSet, dataElements, operands );        
     }
     
     @Test
@@ -105,7 +105,7 @@
         assertNotNull( sectionStore.get( idA ).getDataElements() );
         assertEquals( 2, sectionStore.get( idA ).getDataElements().size() );
         assertNotNull( sectionStore.get( idA ).getGreyedFields() );
-        assertEquals( 2, sectionStore.get( idA ).getGreyedFields().size() );
+        assertEquals( 1, sectionStore.get( idA ).getGreyedFields().size() );
     }
     
     @Test

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java	2014-04-27 21:28:37 +0000
@@ -37,7 +37,7 @@
 import java.util.Collection;
 
 import org.apache.commons.collections.CollectionUtils;
-import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategory;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -53,10 +53,9 @@
 
 /**
  * @author Lars Helge Overland
- * @version $Id$
  */
 public class DataValueDimensionTest
-    extends DhisSpringTest
+    extends DhisTest
 {
     private DataElementCategoryOption male;
     private DataElementCategoryOption female;
@@ -135,6 +134,12 @@
         }
     }
     
+    @Override
+    public boolean emptyDatabaseAfterTest()
+    {
+        return true;
+    }
+    
     @Test
     public void testGetDimensions()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java	2014-03-24 22:27:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java	2014-04-27 21:28:37 +0000
@@ -36,7 +36,7 @@
 import java.util.Collection;
 import java.util.HashSet;
 
-import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -52,7 +52,7 @@
  * @version $Id: DataValueServiceTest.java 5715 2008-09-17 14:05:28Z larshelg $
  */
 public class DataValueServiceTest
-    extends DhisSpringTest
+    extends DhisTest
 {
     // -------------------------------------------------------------------------
     // Supporting data
@@ -133,6 +133,12 @@
 
         optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
     }
+    
+    @Override
+    public boolean emptyDatabaseAfterTest()
+    {
+        return true;
+    }
 
     // -------------------------------------------------------------------------
     // Basic DataValue

=== removed file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java	1970-01-01 00:00:00 +0000
@@ -1,595 +0,0 @@
-package org.hisp.dhis.datavalue;
-
-/*
- * Copyright (c) 2004-2014, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodStore;
-import org.junit.Test;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DataValueStoreTest.java 5715 2008-09-17 14:05:28Z larshelg $
- */
-public class DataValueStoreTest
-    extends DhisSpringTest
-{
-    private DataValueStore dataValueStore;
-
-    private PeriodStore periodStore;
-
-    // -------------------------------------------------------------------------
-    // Supporting data
-    // -------------------------------------------------------------------------
-
-    private DataElement dataElementA;
-
-    private DataElement dataElementB;
-
-    private DataElement dataElementC;
-
-    private DataElement dataElementD;
-
-    private DataElementCategoryOptionCombo optionCombo;
-    
-    private Period periodA;
-
-    private Period periodB;
-
-    private Period periodC;
-
-    private Period periodD;
-
-    private OrganisationUnit sourceA;
-
-    private OrganisationUnit sourceB;
-
-    private OrganisationUnit sourceC;
-
-    private OrganisationUnit sourceD;
-
-    // -------------------------------------------------------------------------
-    // Set up/tear down
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void setUpTest()
-        throws Exception
-    {
-        dataValueStore = (DataValueStore) getBean( DataValueStore.ID );
-
-        dataElementService = (DataElementService) getBean( DataElementService.ID );
-
-        categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-        
-        periodStore = (PeriodStore) getBean( PeriodStore.ID );
-
-        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-        
-        // ---------------------------------------------------------------------
-        // Add supporting data
-        // ---------------------------------------------------------------------
-
-        dataElementA = createDataElement( 'A' );
-        dataElementB = createDataElement( 'B' );
-        dataElementC = createDataElement( 'C' );
-        dataElementD = createDataElement( 'D' );
-        
-        dataElementService.addDataElement( dataElementA );
-        dataElementService.addDataElement( dataElementB );
-        dataElementService.addDataElement( dataElementC );
-        dataElementService.addDataElement( dataElementD );
-
-        periodA = createPeriod( getDay( 5 ), getDay( 6 ) );
-        periodB = createPeriod( getDay( 6 ), getDay( 7 ) );
-        periodC = createPeriod( getDay( 7 ), getDay( 8 ) );
-        periodD = createPeriod( getDay( 8 ), getDay( 9 ) );
-
-        periodStore.addPeriod( periodA );
-        periodStore.addPeriod( periodB );
-        periodStore.addPeriod( periodC );
-        periodStore.addPeriod( periodD );
-
-        sourceA = createOrganisationUnit( 'A' );
-        sourceB = createOrganisationUnit( 'B' );
-        sourceC = createOrganisationUnit( 'C' );
-        sourceD = createOrganisationUnit( 'D' );
-
-        organisationUnitService.addOrganisationUnit( sourceA );
-        organisationUnitService.addOrganisationUnit( sourceB );
-        organisationUnitService.addOrganisationUnit( sourceC );
-        organisationUnitService.addOrganisationUnit( sourceD );        
-
-        optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
-    }
-    
-    // -------------------------------------------------------------------------
-    // Basic DataValue
-    // -------------------------------------------------------------------------
-
-    @Test
-    public void testAddDataValue()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceA, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-
-        try
-        {
-            dataValueStore.addDataValue( dataValueD );
-            fail("Should give unique constraint violation");
-        }
-        catch ( Exception e )
-        {
-            // Expected
-        }
-
-        dataValueA = dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        assertNotNull( dataValueA );
-        assertEquals( sourceA.getId(), dataValueA.getSource().getId() );
-        assertEquals( dataElementA, dataValueA.getDataElement() );
-        assertEquals( periodA, dataValueA.getPeriod() );
-        assertEquals( "1", dataValueA.getValue() );
-
-        dataValueB = dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        assertNotNull( dataValueB );
-        assertEquals( sourceA.getId(), dataValueB.getSource().getId() );
-        assertEquals( dataElementB, dataValueB.getDataElement() );
-        assertEquals( periodA, dataValueB.getPeriod() );
-        assertEquals( "2", dataValueB.getValue() );
-
-        dataValueC = dataValueStore.getDataValue( dataElementC, periodC, sourceA, optionCombo, optionCombo );
-        assertNotNull( dataValueC );
-        assertEquals( sourceA.getId(), dataValueC.getSource().getId() );
-        assertEquals( dataElementC, dataValueC.getDataElement() );
-        assertEquals( periodC, dataValueC.getPeriod() );
-        assertEquals( "3", dataValueC.getValue() );
-    }
-    
-    @Test
-    public void testUpdataDataValue()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceB, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-
-        assertNotNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementB, periodA, sourceB, optionCombo, optionCombo ) );
-
-        dataValueA.setValue( "5" );
-        dataValueStore.updateDataValue( dataValueA );
-
-        dataValueA = dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        assertNotNull( dataValueA );
-        assertEquals( "5", dataValueA.getValue() );
-
-        dataValueB = dataValueStore.getDataValue( dataElementB, periodA, sourceB, optionCombo, optionCombo );
-        assertNotNull( dataValueB );
-        assertEquals( "2", dataValueB.getValue() );
-    }
-
-    @Test
-    public void testDeleteAndGetDataValue()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-
-        assertNotNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValue( dataValueA );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValue( dataValueB );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValue( dataValueC );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValue( dataValueD );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-    }
-
-    @Test
-    public void testDeleteDataValuesBySource()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-
-        assertNotNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValuesBySource( sourceA );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValuesBySource( sourceB );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValuesBySource( sourceC );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValuesBySource( sourceD );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-    }
-
-    @Test
-    public void testDeleteDataValuesByDataElement()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-
-        assertNotNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValuesByDataElement( dataElementA );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValuesByDataElement( dataElementB );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValuesByDataElement( dataElementC );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNotNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-
-        dataValueStore.deleteDataValuesByDataElement( dataElementD );
-        assertNull( dataValueStore.getDataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo ) );
-        assertNull( dataValueStore.getDataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo ) );
-    }
-
-    // -------------------------------------------------------------------------
-    // Collections of DataValues
-    // -------------------------------------------------------------------------
-
-    @Test
-    public void testGetAllDataValues()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-    
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-        
-        Collection<DataValue> dataValues = dataValueStore.getAllDataValues();
-        assertNotNull( dataValues );
-        assertEquals( 4, dataValues.size() );
-    }   
-
-    @Test
-    public void testGetDataValuesSourcePeriod()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-
-        Collection<DataValue> dataValues = dataValueStore.getDataValues( sourceA, periodA );
-        assertNotNull( dataValues );
-        assertEquals( 2, dataValues.size() );
-
-        dataValues = dataValueStore.getDataValues( sourceB, periodC );
-        assertNotNull( dataValues );
-        assertEquals( 1, dataValues.size() );
-
-        dataValues = dataValueStore.getDataValues( sourceB, periodD );
-        assertNotNull( dataValues );
-        assertEquals( 0, dataValues.size() );
-    }
-
-    @Test
-    public void testGetDataValuesSourceDataElement()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementD, periodC, sourceB, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-
-        Collection<DataValue> dataValues = dataValueStore.getDataValues( sourceA, dataElementA );
-        assertNotNull( dataValues );
-        assertEquals( 1, dataValues.size() );
-
-        dataValues = dataValueStore.getDataValues( sourceA, dataElementB );
-        assertNotNull( dataValues );
-        assertEquals( 1, dataValues.size() );
-
-        dataValues = dataValueStore.getDataValues( sourceA, dataElementC );
-        assertNotNull( dataValues );
-        assertEquals( 0, dataValues.size() );
-    }
-
-    @Test
-    public void testGetDataValuesSourcesDataElement()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementA, periodC, sourceB, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-
-        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
-        sources.add( sourceA );
-        sources.add( sourceB );
-
-        Collection<DataValue> dataValues = dataValueStore.getDataValues( sources, dataElementA );
-        assertNotNull( dataValues );
-        assertEquals( 2, dataValues.size() );
-
-        dataValues = dataValueStore.getDataValues( sources, dataElementB );
-        assertNotNull( dataValues );
-        assertEquals( 1, dataValues.size() );
-
-        dataValues = dataValueStore.getDataValues( sources, dataElementC );
-        assertNotNull( dataValues );
-        assertEquals( 0, dataValues.size() );
-    }
-
-    @Test
-    public void testGetDataValuesSourcePeriodDataElements()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementB, periodA, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementC, periodC, sourceD, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementA, periodC, sourceB, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-
-        Collection<DataElement> dataElements = new HashSet<DataElement>();
-        dataElements.add( dataElementA );
-        dataElements.add( dataElementB );
-
-        Collection<DataValue> dataValues = dataValueStore.getDataValues( sourceA, periodA, dataElements );
-        assertNotNull( dataValues );
-        assertEquals( 2, dataValues.size() );
-
-        dataValues = dataValueStore.getDataValues( sourceB, periodC, dataElements );
-        assertNotNull( dataValues );
-        assertEquals( 1, dataValues.size() );
-
-        dataValues = dataValueStore.getDataValues( sourceD, periodC, dataElements );
-        assertNotNull( dataValues );
-        assertEquals( 0, dataValues.size() );
-    }
-
-    @Test
-    public void testGetDataValuesDataElementPeriodsSources()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceB, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementA, periodB, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementA, periodA, sourceC, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementB, periodB, sourceD, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-        
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-        
-        Collection<Period> periods = new HashSet<Period>();
-        periods.add( periodA );
-        periods.add( periodB );
-
-        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
-        sources.add( sourceA );
-        sources.add( sourceB );
-        
-        Collection<DataValue> dataValues = dataValueStore.getDataValues( dataElementA, periods, sources );
-        
-        assertEquals( dataValues.size(), 2 );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueB ) );
-    }
-
-    @Test
-    public void testGetDataValuesOptionComboDataElementPeriodsSources()
-        throws Exception
-    {
-        DataValue dataValueA = new DataValue( dataElementA, periodA, sourceB, optionCombo, optionCombo );
-        dataValueA.setValue( "1" );
-        DataValue dataValueB = new DataValue( dataElementA, periodB, sourceA, optionCombo, optionCombo );
-        dataValueB.setValue( "2" );
-        DataValue dataValueC = new DataValue( dataElementA, periodA, sourceC, optionCombo, optionCombo );
-        dataValueC.setValue( "3" );
-        DataValue dataValueD = new DataValue( dataElementB, periodB, sourceD, optionCombo, optionCombo );
-        dataValueD.setValue( "4" );
-        
-        dataValueStore.addDataValue( dataValueA );
-        dataValueStore.addDataValue( dataValueB );
-        dataValueStore.addDataValue( dataValueC );
-        dataValueStore.addDataValue( dataValueD );
-        
-        Collection<Period> periods = new HashSet<Period>();
-        periods.add( periodA );
-        periods.add( periodB );
-
-        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
-        sources.add( sourceA );
-        sources.add( sourceB );
-        
-        Collection<DataValue> dataValues = dataValueStore.getDataValues( dataElementA, optionCombo, periods, sources );
-        
-        assertEquals( dataValues.size(), 2 );
-        assertTrue( dataValues.contains( dataValueA ) );
-        assertTrue( dataValues.contains( dataValueB ) );
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java	2014-04-27 21:28:37 +0000
@@ -39,7 +39,7 @@
 import java.util.Locale;
 import java.util.Map;
 
-import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.DhisTest;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.junit.Before;
@@ -49,7 +49,7 @@
  * @author Lars Helge Overland
  */
 public class I18nServiceTest
-    extends DhisSpringTest
+    extends DhisTest
 {
     private I18nService i18nService;
 
@@ -66,6 +66,12 @@
         dataElementService = (DataElementService) getBean( DataElementService.ID );
     }
 
+    @Override
+    public boolean emptyDatabaseAfterTest()
+    {
+        return true;
+    }
+    
     // -------------------------------------------------------------------------
     // Tests
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java	2014-04-27 21:28:37 +0000
@@ -108,8 +108,7 @@
         dataElementService.addDataElement( dataElement2 );
         dataElementService.addDataElement( dataElement3 );
         dataElementService.addDataElement( dataElement4 );
-        
-        
+                
         DataElementCategoryOptionCombo optionCombo1 = new DataElementCategoryOptionCombo();        
         categoryService.addDataElementCategoryOptionCombo( optionCombo1 );
         
@@ -137,10 +136,6 @@
 
         assertTrue( minMaxDataElementStore.get( mmdeid1 ).getMax() == 100 );
 
-        minMaxDataElement1.setMax( 200 );
-        minMaxDataElementStore.update( minMaxDataElement1 );
-        assertTrue( minMaxDataElementStore.get( mmdeid1 ).getMax() == 200 );
-
         Collection<DataElement> dataElements1 = new HashSet<DataElement>();
         dataElements1.add( dataElement1 );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/option/OptionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/option/OptionServiceTest.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/option/OptionServiceTest.java	2014-04-27 21:28:37 +0000
@@ -34,14 +34,14 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.DhisTest;
 import org.junit.Test;
 
 /**
  * @author Lars Helge Overland
  */
 public class OptionServiceTest
-    extends DhisSpringTest
+    extends DhisTest
 {
     private OptionService optionService;
 
@@ -66,6 +66,12 @@
         optionSetA.setOptions( options );
         optionSetB.setOptions( options );
     }
+    
+    @Override
+    public boolean emptyDatabaseAfterTest()
+    {
+        return true;
+    }
 
     @Test
     public void testSaveGet()

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java	2014-03-28 01:51:34 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java	2014-04-27 21:28:37 +0000
@@ -85,10 +85,13 @@
         emptyTable( "datavalue" );
         emptyTable( "completedatasetregistration" );
 
+        emptyTable( "reporttable_categorydimensions" );
+        emptyTable( "reporttable_categoryoptiongroups" );
         emptyTable( "reporttable_dataelements" );
         emptyTable( "reporttable_datasets" );
         emptyTable( "reporttable_indicators" );
         emptyTable( "reporttable_periods" );
+        emptyTable( "reporttable_itemorgunitgroups" );
         emptyTable( "reporttable_organisationunits" );
         emptyTable( "reporttable_dataelementgroups" );
         emptyTable( "reporttable_orgunitgroups" );
@@ -96,6 +99,21 @@
         emptyTable( "reporttable_rows" );
         emptyTable( "reporttable_filters" );
         emptyTable( "reporttable" );
+        
+        emptyTable( "chart_periods" );
+        emptyTable( "chart_orgunitlevels" );
+        emptyTable( "chart_orgunitgroups" );
+        emptyTable( "chart_organisationunits" );
+        emptyTable( "chart_itemorgunitgroups" );
+        emptyTable( "chart_indicators" );
+        emptyTable( "chart_filters" );
+        emptyTable( "chart_datasets" );
+        emptyTable( "chart_dataelements" );
+        emptyTable( "chart_dataelementoperands" );
+        emptyTable( "chart_dataelementgroups" );
+        emptyTable( "chart_categoryoptiongroups" );
+        emptyTable( "chart_categorydimensions" );
+        emptyTable( "chart" );
 
         emptyTable( "userrolemembers" );
         emptyTable( "userroledataset" );