← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7135: Added test for importing datavalueset with period which is not persisted in the database.

 

------------------------------------------------------------
revno: 7135
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-01 13:21:51 +0100
message:
  Added test for importing datavalueset with period which is not persisted in the database.
  Currently fails so marked with @Ignore
added:
  dhis-2/dhis-dxf2/src/test/resources/datavalueset/dataValueSetC.xml
modified:
  dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetServiceTest.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-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetServiceTest.java'
--- dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetServiceTest.java	2012-05-31 13:16:24 +0000
+++ dhis-2/dhis-dxf2/src/test/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetServiceTest.java	2012-06-01 12:21:51 +0000
@@ -54,6 +54,7 @@
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ClassPathResource;
@@ -243,4 +244,19 @@
         assertNotNull( dataValues );
         assertEquals( 0, dataValues.size() );
     }
+
+    // Testing importing datavalues where period is not pre-existing fails
+    @Ignore
+    @Test
+    public void testImportDataValuesWithNewPeriod()
+        throws Exception
+    {
+        ImportSummary summary = dataValueSetService.saveDataValueSet( new ClassPathResource( "datavalueset/dataValueSetC.xml" ).getInputStream() );
+        
+        Collection<DataValue> dataValues = dataValueService.getAllDataValues();
+        
+        assertNotNull( dataValues );
+        assertEquals( 3, dataValues.size() );
+    }
+
 }

=== added file 'dhis-2/dhis-dxf2/src/test/resources/datavalueset/dataValueSetC.xml'
--- dhis-2/dhis-dxf2/src/test/resources/datavalueset/dataValueSetC.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-dxf2/src/test/resources/datavalueset/dataValueSetC.xml	2012-06-01 12:21:51 +0000
@@ -0,0 +1,5 @@
+<dataValueSet xmlns="http://dhis2.org/schema/dxf/2.0"; dataSet="pBOMPrpg1QX" completeDate="2012-01-09" period="201205" orgUnit="DiszpKrYNg8">
+    <dataValue dataElement="f7n9E0hX8qk" value="10001" storedBy="john" timestamp="2012-01-01" comment="comment" followup="false"/>
+    <dataValue dataElement="Ix2HsbDMLea" value="10002" storedBy="john" timestamp="2012-01-02" comment="comment" followup="false"/>
+    <dataValue dataElement="eY5ehpbEsB7" value="10003" storedBy="john" timestamp="2012-01-03" comment="comment" followup="false"/>
+</dataValueSet>
\ No newline at end of file