← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 417: Replaced the DummySource with MockSource for testing.

 

------------------------------------------------------------
revno: 417
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-07-06 19:45:57 +0200
message:
  Replaced the DummySource with MockSource for testing.
removed:
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/DummySource.java
added:
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/mock/MockSource.java
renamed:
  dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/DummySource.hbm.xml => dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/MockSource.hbm.xml
modified:
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetStoreTest.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/datavalue/DataValueStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.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/period/PeriodServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/SourceStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java
  dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/MockSource.hbm.xml

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java	2009-07-06 17:45:57 +0000
@@ -38,10 +38,10 @@
 import java.util.Date;
 
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.DummySource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -99,9 +99,9 @@
 
         sourceStore = (SourceStore) getBean( SourceStore.ID );
 
-        sourceA = new DummySource( "SourceA" );
-        sourceB = new DummySource( "SourceB" );
-        sourceC = new DummySource( "SourceC" );
+        sourceA = new MockSource( "SourceA" );
+        sourceB = new MockSource( "SourceB" );
+        sourceC = new MockSource( "SourceC" );
         
         sourceStore.addSource( sourceA );
         sourceStore.addSource( sourceB ); 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationStoreTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationStoreTest.java	2009-07-06 17:45:57 +0000
@@ -38,10 +38,10 @@
 import java.util.Date;
 
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.DummySource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -100,8 +100,8 @@
         periodA = createPeriod( new MonthlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 1, 31 ) );
         periodB = createPeriod( new MonthlyPeriodType(), getDate( 2000, 2, 1 ), getDate( 2000, 2, 28 ) );
         
-        sourceA = new DummySource( "SourceA" );
-        sourceB = new DummySource( "SourceB" );
+        sourceA = new MockSource( "SourceA" );
+        sourceB = new MockSource( "SourceB" );
         
         dataSetService.addDataSet( dataSetA );
         dataSetService.addDataSet( dataSetB );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java	2009-07-06 17:45:57 +0000
@@ -36,12 +36,12 @@
 import java.util.HashSet;
 
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.PeriodStore;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.WeeklyPeriodType;
 import org.hisp.dhis.period.YearlyPeriodType;
-import org.hisp.dhis.source.DummySource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -200,9 +200,9 @@
     @Test
     public void testGetDataSetsBySource()
     {
-        Source sourceA = new DummySource( "A" );
-        Source sourceB = new DummySource( "B" );
-        Source sourceC = new DummySource( "C" );
+        Source sourceA = new MockSource( "A" );
+        Source sourceB = new MockSource( "B" );
+        Source sourceC = new MockSource( "C" );
         
         sourceStore.addSource( sourceA );
         sourceStore.addSource( sourceB );
@@ -247,10 +247,10 @@
     @Test
     public void testGetDataSetsBySources()
     {
-        Source sourceA = new DummySource( "A" );
-        Source sourceB = new DummySource( "B" );
-        Source sourceC = new DummySource( "C" );
-        Source sourceD = new DummySource( "D" );
+        Source sourceA = new MockSource( "A" );
+        Source sourceB = new MockSource( "B" );
+        Source sourceC = new MockSource( "C" );
+        Source sourceD = new MockSource( "D" );
         
         sourceStore.addSource( sourceA );
         sourceStore.addSource( sourceB );
@@ -304,12 +304,12 @@
     @Test
     public void testGetSourcesAssociatedWithDataSet()
     {
-        Source sourceA = new DummySource( "A" );
-        Source sourceB = new DummySource( "B" );
-        Source sourceC = new DummySource( "C" );
-        Source sourceD = new DummySource( "D" );
-        Source sourceE = new DummySource( "E" );
-        Source sourceF = new DummySource( "F" );
+        Source sourceA = new MockSource( "A" );
+        Source sourceB = new MockSource( "B" );
+        Source sourceC = new MockSource( "C" );
+        Source sourceD = new MockSource( "D" );
+        Source sourceE = new MockSource( "E" );
+        Source sourceF = new MockSource( "F" );
         
         sourceStore.addSource( sourceA );
         sourceStore.addSource( sourceB );
@@ -361,8 +361,8 @@
         dataSetService.addDataSet( dataSet1 );
         dataSetService.addDataSet( dataSet2 );
 
-        Source source1 = new DummySource( "Source1" );
-        Source source2 = new DummySource( "Source2" );
+        Source source1 = new MockSource( "Source1" );
+        Source source2 = new MockSource( "Source2" );
         sourceStore.addSource( source1 );
         sourceStore.addSource( source2 );
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetStoreTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetStoreTest.java	2009-07-06 17:45:57 +0000
@@ -35,12 +35,12 @@
 import java.util.Collection;
 
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.PeriodStore;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.period.WeeklyPeriodType;
 import org.hisp.dhis.period.YearlyPeriodType;
-import org.hisp.dhis.source.DummySource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -214,8 +214,8 @@
         dataSetStore.addDataSet( dataSet1 );
         dataSetStore.addDataSet( dataSet2 );
 
-        Source source1 = new DummySource( "Source1" );
-        Source source2 = new DummySource( "Source2" );
+        Source source1 = new MockSource( "Source1" );
+        Source source2 = new MockSource( "Source2" );
         sourceStore.addSource( source1 );
         sourceStore.addSource( source2 );
 

=== 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	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java	2009-07-06 17:45:57 +0000
@@ -41,9 +41,9 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
 import org.hisp.dhis.dataelement.DataElementStore;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.DummySource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -126,10 +126,10 @@
         periodC = createPeriod( getDay( 7 ), getDay( 8 ) );
         periodD = createPeriod( getDay( 8 ), getDay( 9 ) );
         
-        sourceA = new DummySource( "SourceA" );
-        sourceB = new DummySource( "SourceB" );
-        sourceC = new DummySource( "SourceC" );
-        sourceD = new DummySource( "SourceD" );
+        sourceA = new MockSource( "SourceA" );
+        sourceB = new MockSource( "SourceB" );
+        sourceC = new MockSource( "SourceC" );
+        sourceD = new MockSource( "SourceD" );
 
         sourceStore.addSource( sourceA );
         sourceStore.addSource( sourceB );

=== modified 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	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java	2009-07-06 17:45:57 +0000
@@ -41,9 +41,9 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
 import org.hisp.dhis.dataelement.DataElementStore;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodStore;
-import org.hisp.dhis.source.DummySource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -135,10 +135,10 @@
         periodStore.addPeriod( periodC );
         periodStore.addPeriod( periodD );
 
-        sourceA = new DummySource( "SourceA" );
-        sourceB = new DummySource( "SourceB" );
-        sourceC = new DummySource( "SourceC" );
-        sourceD = new DummySource( "SourceD" );
+        sourceA = new MockSource( "SourceA" );
+        sourceB = new MockSource( "SourceB" );
+        sourceC = new MockSource( "SourceC" );
+        sourceD = new MockSource( "SourceD" );
 
         sourceStore.addSource( sourceA );
         sourceStore.addSource( sourceB );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java	2009-07-03 10:03:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java	2009-07-06 17:45:57 +0000
@@ -47,8 +47,8 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataelement.Operand;
 import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.DummySource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -130,7 +130,7 @@
         
         period = createPeriod( getDate( 2000, 1, 1 ), getDate( 2000, 2, 1 ) );
         
-        source = new DummySource( "SourceA" );
+        source = new MockSource( "SourceA" );
         
         sourceStore.addSource( source );
         

=== 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	2009-07-05 20:32:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java	2009-07-06 17:45:57 +0000
@@ -39,7 +39,7 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
 import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.source.DummySource;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -76,8 +76,8 @@
     public void testBasic()
         throws Exception
     {
-        Source source1 = new DummySource("Source1name");
-        Source source2 = new DummySource("Source2name");
+        Source source1 = new MockSource("Source1name");
+        Source source2 = new MockSource("Source2name");
 
         sourceStore.addSource( source1 );
         sourceStore.addSource( source2 );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java	2009-07-06 17:45:57 +0000
@@ -46,7 +46,7 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.source.DummySource;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -498,9 +498,9 @@
         Period w04 = new Period( weekly, getDate( 2008, 1, 21 ), getDate( 2008, 1, 27 ) );
         Period w05 = new Period( weekly, getDate( 2008, 1, 28 ), getDate( 2008, 2, 3 ) );
                 
-        Source sourceA = new DummySource( "SourceA" );
-        Source sourceB = new DummySource( "SourceB" );
-        Source sourceC = new DummySource( "SourceC" );
+        Source sourceA = new MockSource( "SourceA" );
+        Source sourceB = new MockSource( "SourceB" );
+        Source sourceC = new MockSource( "SourceC" );
         
         DataValue dataValueA = new DataValue( dataElementA, jan, sourceA, optionCombo );
         dataValueA.setValue( "1" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java	2009-07-06 17:45:57 +0000
@@ -46,7 +46,7 @@
 import org.hisp.dhis.dataelement.DataElementStore;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueStore;
-import org.hisp.dhis.source.DummySource;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
@@ -506,9 +506,9 @@
         Period w04 = new Period( weekly, getDate( 2008, 1, 21 ), getDate( 2008, 1, 27 ) );
         Period w05 = new Period( weekly, getDate( 2008, 1, 28 ), getDate( 2008, 2, 3 ) );
                 
-        Source sourceA = new DummySource( "SourceA" );
-        Source sourceB = new DummySource( "SourceB" );
-        Source sourceC = new DummySource( "SourceC" );
+        Source sourceA = new MockSource( "SourceA" );
+        Source sourceB = new MockSource( "SourceB" );
+        Source sourceC = new MockSource( "SourceC" );
         
         DataValue dataValueA = new DataValue( dataElementA, jan, sourceA, optionCombo );
         dataValueA.setValue( "1" );

=== removed file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/DummySource.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/DummySource.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/DummySource.java	1970-01-01 00:00:00 +0000
@@ -1,104 +0,0 @@
-package org.hisp.dhis.source;
-
-/*
- * Copyright (c) 2004-2007, 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.
- */
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DummySource.java 5424 2008-06-16 01:11:56Z larshelg $
- */
-public class DummySource
-    extends Source
-{
-    private String name;
-
-    // -------------------------------------------------------------------------
-    // Constructors
-    // -------------------------------------------------------------------------
-
-    public DummySource()
-    {
-    }
-
-    public DummySource( String name )
-    {
-        this.name = name;
-    }
-
-    // -------------------------------------------------------------------------
-    // hashCode and equals
-    // -------------------------------------------------------------------------
-
-    @Override
-    public int hashCode()
-    {
-        return name.hashCode();
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-
-        if ( o == null )
-        {
-            return false;
-        }
-
-        if ( !(o instanceof DummySource) )
-        {
-            return false;
-        }
-
-        final DummySource other = (DummySource) o;
-
-        return name.equals( other.getName() );
-    }
-    
-    @Override
-    public String toString()
-    {
-        return "[" + name + "]";
-    }
-
-    // -------------------------------------------------------------------------
-    // Getters and setters
-    // -------------------------------------------------------------------------
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/SourceStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/SourceStoreTest.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/SourceStoreTest.java	2009-07-06 17:45:57 +0000
@@ -32,6 +32,7 @@
 import static junit.framework.Assert.assertNull;
 
 import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.mock.MockSource;
 import org.junit.Test;
 
 /**
@@ -61,8 +62,8 @@
     @Test
     public void addGetSource()
     {
-        Source sourceA = new DummySource( "SourceA" );
-        Source sourceB = new DummySource( "SourceB" );
+        Source sourceA = new MockSource( "SourceA" );
+        Source sourceB = new MockSource( "SourceB" );
         
         int idA = sourceStore.addSource( sourceA );
         int idB = sourceStore.addSource( sourceB );
@@ -74,7 +75,7 @@
     @Test
     public void updateSource()
     {
-        DummySource source = new DummySource( "SourceA" );
+        MockSource source = new MockSource( "SourceA" );
         
         int id = sourceStore.addSource( source );
         
@@ -90,8 +91,8 @@
     @Test
     public void delete()
     {
-        Source sourceA = new DummySource( "SourceA" );
-        Source sourceB = new DummySource( "SourceB" );
+        Source sourceA = new MockSource( "SourceA" );
+        Source sourceB = new MockSource( "SourceB" );
         
         int idA = sourceStore.addSource( sourceA );
         int idB = sourceStore.addSource( sourceB );
@@ -113,8 +114,8 @@
     @Test
     public void getAll()
     {
-        Source sourceA = new DummySource( "SourceA" );
-        Source sourceB = new DummySource( "SourceB" );
+        Source sourceA = new MockSource( "SourceA" );
+        Source sourceB = new MockSource( "SourceB" );
         
         sourceStore.addSource( sourceA );
         sourceStore.addSource( sourceB );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java	2009-06-30 23:08:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java	2009-07-06 17:45:57 +0000
@@ -49,11 +49,11 @@
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.mock.MockSource;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.source.DummySource;
 import org.hisp.dhis.source.Source;
 import org.hisp.dhis.source.SourceStore;
 import org.hisp.dhis.system.util.MathUtils;
@@ -172,8 +172,8 @@
 
         dataSet = createDataSet( 'A', periodType );
         
-        sourceA = new DummySource( "SourceA" );
-        sourceB = new DummySource( "SourceB" );
+        sourceA = new MockSource( "SourceA" );
+        sourceB = new MockSource( "SourceB" );
         
         sourceA.getDataSets().add( dataSet );
         sourceB.getDataSets().add( dataSet );

=== renamed file 'dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/DummySource.hbm.xml' => 'dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/MockSource.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/DummySource.hbm.xml	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/MockSource.hbm.xml	2009-07-06 17:45:57 +0000
@@ -4,8 +4,8 @@
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>
 
 <hibernate-mapping>
-  <joined-subclass name="org.hisp.dhis.source.DummySource"
-    extends="org.hisp.dhis.source.Source" table="dummysource">
+  <joined-subclass name="org.hisp.dhis.mock.MockSource"
+    extends="org.hisp.dhis.source.Source" table="mocksource">
     <key column="id"/>
     <property name="name">
       <column name="name" not-null="true" unique="true"/>

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-06-02 12:13:35 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2009-07-06 17:45:57 +0000
@@ -41,11 +41,13 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * @author Jan Henrik Overland
  * @version $Id$
  */
+@Transactional
 public class DefaultMappingService
     implements MappingService
 {

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java	2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java	2009-07-06 17:45:57 +0000
@@ -41,7 +41,6 @@
 import org.hisp.dhis.mapping.MappingStore;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
-import org.springframework.transaction.annotation.Transactional;
 
 /**
  * @author Jan Henrik Overland
@@ -65,7 +64,6 @@
     // Map
     // -------------------------------------------------------------------------
 
-    @Transactional
     public int addMap( Map map )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -73,7 +71,6 @@
         return (Integer) session.save( map );
     }
 
-    @Transactional
     public void updateMap( Map map )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -81,7 +78,6 @@
         session.update( map );
     }
 
-    @Transactional
     public void deleteMap( Map map )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -89,7 +85,6 @@
         session.delete( map );
     }
 
-    @Transactional
     public Map getMap( int id )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -97,7 +92,6 @@
         return (Map) session.get( Map.class, id );
     }
 
-    @Transactional
     public Map getMapByMapLayerPath( String mapLayerPath )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -109,7 +103,6 @@
         return (Map) criteria.uniqueResult();
     }
 
-    @Transactional
     @SuppressWarnings( "unchecked" )
     public Collection<Map> getMapsByType( String type )
     {
@@ -122,7 +115,6 @@
         return criteria.list();
     }
 
-    @Transactional
     @SuppressWarnings( "unchecked" )
     public Collection<Map> getAllMaps()
     {
@@ -133,7 +125,6 @@
         return criteria.list();
     }
 
-    @Transactional
     @SuppressWarnings( "unchecked" )
     public Collection<Map> getMapsAtLevel( OrganisationUnitLevel organisationUnitLevel )
     {
@@ -150,7 +141,6 @@
     // MapOrganisationUnitRelation
     // -------------------------------------------------------------------------
 
-    @Transactional
     public int addMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -158,7 +148,6 @@
         return (Integer) session.save( mapOrganisationUnitRelation );
     }
 
-    @Transactional
     public void updateMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -166,15 +155,13 @@
         session.update( mapOrganisationUnitRelation );
     }
 
-    @Transactional
     public void deleteMapOrganisationUnitRelation( MapOrganisationUnitRelation mapOrganisationUnitRelation )
     {
         Session session = sessionFactory.getCurrentSession();
 
         session.delete( mapOrganisationUnitRelation );
     }
-
-    @Transactional
+    
     public MapOrganisationUnitRelation getMapOrganisationUnitRelation( int id )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -182,7 +169,6 @@
         return (MapOrganisationUnitRelation) session.get( MapOrganisationUnitRelation.class, id );
     }
 
-    @Transactional
     public MapOrganisationUnitRelation getMapOrganisationUnitRelation( Map map, OrganisationUnit organisationUnit )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -195,7 +181,6 @@
         return (MapOrganisationUnitRelation) criteria.uniqueResult();
     }
 
-    @Transactional
     @SuppressWarnings( "unchecked" )
     public Collection<MapOrganisationUnitRelation> getAllMapOrganisationUnitRelations()
     {
@@ -206,7 +191,6 @@
         return criteria.list();
     }
 
-    @Transactional
     @SuppressWarnings( "unchecked" )
     public Collection<MapOrganisationUnitRelation> getMapOrganisationUnitRelationByMap( Map map )
     {
@@ -219,7 +203,6 @@
         return criteria.list();
     }
 
-    @Transactional
     public int deleteMapOrganisationUnitRelations( OrganisationUnit organisationUnit )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -230,7 +213,6 @@
         return query.setParameter( "organisationUnit", organisationUnit ).executeUpdate();
     }
 
-    @Transactional
     public int deleteMapOrganisationUnitRelations( Map map )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -244,7 +226,6 @@
     // MapLegendSet
     // -------------------------------------------------------------------------
 
-    @Transactional
     public int addMapLegendSet( MapLegendSet legendSet )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -252,7 +233,6 @@
         return (Integer) session.save( legendSet );
     }
 
-    @Transactional
     public void updateMapLegendSet( MapLegendSet legendSet )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -260,7 +240,6 @@
         session.update( legendSet );
     }
 
-    @Transactional
     public void deleteMapLegendSet( MapLegendSet legendSet )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -268,7 +247,6 @@
         session.delete( legendSet );
     }
 
-    @Transactional
     public MapLegendSet getMapLegendSet( int id )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -276,7 +254,6 @@
         return (MapLegendSet) session.get( MapLegendSet.class, id );
     }
 
-    @Transactional
     public MapLegendSet getMapLegendSetByName( String name )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -288,7 +265,6 @@
         return (MapLegendSet) criteria.uniqueResult();
     }
 
-    @Transactional
     @SuppressWarnings( "unchecked" )
     public Collection<MapLegendSet> getAllMapLegendSets()
     {
@@ -303,7 +279,6 @@
     // MapView
     // -------------------------------------------------------------------------
 
-    @Transactional
     public int addMapView( MapView view )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -311,7 +286,6 @@
         return (Integer) session.save( view );
     }
 
-    @Transactional
     public void updateMapView( MapView view )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -319,7 +293,6 @@
         session.update( view );
     }
 
-    @Transactional
     public void deleteMapView( MapView view )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -327,7 +300,6 @@
         session.delete( view );
     }
 
-    @Transactional
     public MapView getMapView( int id )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -335,7 +307,6 @@
         return (MapView) session.get( MapView.class, id );
     }
 
-    @Transactional
     public MapView getMapViewByName( String name )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -347,7 +318,6 @@
         return (MapView) criteria.uniqueResult();
     }
 
-    @Transactional
     @SuppressWarnings( "unchecked" )
     public Collection<MapView> getAllMapViews()
     {

=== added file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/mock/MockSource.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/mock/MockSource.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/mock/MockSource.java	2009-07-06 17:45:57 +0000
@@ -0,0 +1,106 @@
+package org.hisp.dhis.mock;
+
+import org.hisp.dhis.source.Source;
+
+/*
+ * Copyright (c) 2004-2007, 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.
+ */
+
+/**
+ * @author Torgeir Lorange Ostby
+ * @version $Id: DummySource.java 5424 2008-06-16 01:11:56Z larshelg $
+ */
+public class MockSource
+    extends Source
+{
+    private String name;
+
+    // -------------------------------------------------------------------------
+    // Constructors
+    // -------------------------------------------------------------------------
+
+    public MockSource()
+    {
+    }
+
+    public MockSource( String name )
+    {
+        this.name = name;
+    }
+
+    // -------------------------------------------------------------------------
+    // hashCode and equals
+    // -------------------------------------------------------------------------
+
+    @Override
+    public int hashCode()
+    {
+        return name.hashCode();
+    }
+
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+
+        if ( o == null )
+        {
+            return false;
+        }
+
+        if ( !(o instanceof MockSource) )
+        {
+            return false;
+        }
+
+        final MockSource other = (MockSource) o;
+
+        return name.equals( other.getName() );
+    }
+    
+    @Override
+    public String toString()
+    {
+        return "[" + name + "]";
+    }
+
+    // -------------------------------------------------------------------------
+    // Getters and setters
+    // -------------------------------------------------------------------------
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+}



--
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.