← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1253: Added test for zip and gzip signatures in stream

 

------------------------------------------------------------
revno: 1253
committer: Bob Jolliffe <bobj@bobj-laptop>
branch nick: trunk
timestamp: Sat 2009-12-19 15:20:41 +0000
message:
  Added test for zip and gzip signatures in stream 
added:
  dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/StreamUtilsTest.java
  dhis-2/dhis-support/dhis-support-system/src/test/resources/Export.xml
  dhis-2/dhis-support/dhis-support-system/src/test/resources/Export.xml.gz
  dhis-2/dhis-support/dhis-support-system/src/test/resources/dxfA.zip
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java	2009-09-14 13:52:08 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/StreamUtils.java	2009-12-19 15:20:41 +0000
@@ -337,7 +337,71 @@
             }
         }
     }
-    
+
+    /**
+     * Test for zip stream signature.
+     *
+     * @param instream the BufferedInputStream to test.
+     */
+    public static boolean isZip(BufferedInputStream instream)
+    {
+        /*
+        Signature of zip stream from http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+        Local file header:
+        local file header signature     4 bytes  (0x04034b50)
+         */
+        instream.mark(4);
+        byte[] b = new byte[4];
+        byte[] zipSig = new byte[4];
+        zipSig[0] = 0x50;
+        zipSig[1] = 0x4b;
+        zipSig[2] = 0x03;
+        zipSig[3] = 0x04;
+
+        try {
+            instream.read(b, 0, 4);
+        } catch (Exception ex) {
+            throw new RuntimeException( "Couldn't read header from stream ", ex );
+        }
+        try {
+            instream.reset();
+        } catch (Exception ex) {
+            throw new RuntimeException( "Couldn't reset stream ", ex );
+        }
+        return Arrays.equals(b, zipSig) ? true : false;
+    }
+
+    /**
+     * Test for Gzip stream signature.
+     *
+     * @param instream the BufferedInputStream to test.
+     */
+    public static boolean isGZip(BufferedInputStream instream)
+    {
+        /*
+        Signature of gzip stream from RFC 1952:
+        ID1 (IDentification 1)
+        ID2 (IDentification 2)
+        These have the fixed values ID1 = 31 (0x1f, \037), ID2 = 139
+        (0x8b, \213), to identify the file as being in gzip format.
+         */
+        instream.mark(2);
+        byte[] b = new byte[2];
+
+        try {
+            instream.read(b, 0, 2);
+        } catch (Exception ex) {
+            throw new RuntimeException("Couldn't read header from stream ", ex);
+        }
+        try {
+            instream.reset();
+        } catch (Exception ex) {
+            throw new RuntimeException("Couldn't reset stream ", ex);
+        }
+
+        return (b[0] == 31 && b[1] == -117) ? true : false;
+    }
+
     /**
      * Reads the next ZIP file entry from the ZipInputStream and positions the 
      * stream at the beginning of the entry data.

=== added file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/StreamUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/StreamUtilsTest.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/StreamUtilsTest.java	2009-12-19 15:20:41 +0000
@@ -0,0 +1,83 @@
+package org.hisp.dhis.system.util;
+
+/*
+ * Copyright (c) 2004-2005, 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 <ORGANIZATION> 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 java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author bobj
+ * @version created 19-Dec-2009
+ */
+public class StreamUtilsTest
+        extends TestCase {
+
+    public static BufferedInputStream zipStream;
+
+    public static BufferedInputStream gzipStream;
+
+    @Override
+    public void setUp()
+    {
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+
+        zipStream = new BufferedInputStream(classLoader.getResourceAsStream( "dxfA.zip" ));
+
+        gzipStream = new BufferedInputStream(classLoader.getResourceAsStream( "Export.xml.gz" ));
+    }
+
+    @Override
+    public void tearDown() throws Exception
+    {
+        zipStream.close();
+
+        gzipStream.close();
+    }
+
+    public void testZip()
+    {
+        assertTrue(StreamUtils.isZip(zipStream));
+
+        assertFalse(StreamUtils.isGZip(zipStream));
+    }
+
+    public void testGZip()
+    {
+        assertTrue(StreamUtils.isGZip(gzipStream));
+
+        assertFalse(StreamUtils.isZip(gzipStream));
+    }
+}
+
+

=== added file 'dhis-2/dhis-support/dhis-support-system/src/test/resources/Export.xml'
--- dhis-2/dhis-support/dhis-support-system/src/test/resources/Export.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/resources/Export.xml	2009-12-19 15:20:41 +0000
@@ -0,0 +1,627 @@
+<?xml version='1.0'?>
+<dxf>
+    <categoryOptions>
+        <categoryOption>
+            <id>65</id>
+            <name>categoryOptionA</name>
+        </categoryOption>
+        <categoryOption>
+            <id>66</id>
+            <name>categoryOptionB</name>
+        </categoryOption>
+        <categoryOption>
+            <id>67</id>
+            <name>categoryOptionC</name>
+        </categoryOption>
+        <categoryOption>
+            <id>68</id>
+            <name>categoryOptionD</name>
+        </categoryOption>
+    </categoryOptions>
+    <categories>
+        <category>
+            <id>65</id>
+            <name>categoryA</name>
+        </category>
+        <category>
+            <id>66</id>
+            <name>categoryB</name>
+        </category>
+    </categories>
+    <categoryCombos>
+        <categoryCombo>
+            <id>65</id>
+            <name>categoryComboA</name>
+        </categoryCombo>
+        <categoryCombo>
+            <id>66</id>
+            <name>categoryComboB</name>
+        </categoryCombo>
+    </categoryCombos>
+    <categoryOptionCombos>
+        <categoryOptionCombo>
+            <id>65</id>
+            <categoryCombo>
+                <id>65</id>
+                <name>categoryComboA</name>
+            </categoryCombo>
+            <categoryOptions>
+                <categoryOption>
+                    <id>65</id>
+                    <name>categoryOptionA</name>
+                </categoryOption>
+                <categoryOption>
+                    <id>67</id>
+                    <name>categoryOptionC</name>
+                </categoryOption>
+            </categoryOptions>
+        </categoryOptionCombo>
+        <categoryOptionCombo>
+            <id>66</id>
+            <categoryCombo>
+                <id>65</id>
+                <name>categoryComboA</name>
+            </categoryCombo>
+            <categoryOptions>
+                <categoryOption>
+                    <id>66</id>
+                    <name>categoryOptionB</name>
+                </categoryOption>
+                <categoryOption>
+                    <id>68</id>
+                    <name>categoryOptionD</name>
+                </categoryOption>
+            </categoryOptions>
+        </categoryOptionCombo>
+        <categoryOptionCombo>
+            <id>67</id>
+            <categoryCombo>
+                <id>66</id>
+                <name>categoryComboB</name>
+            </categoryCombo>
+            <categoryOptions>
+                <categoryOption>
+                    <id>65</id>
+                    <name>categoryOptionA</name>
+                </categoryOption>
+            </categoryOptions>
+        </categoryOptionCombo>
+        <categoryOptionCombo>
+            <id>68</id>
+            <categoryCombo>
+                <id>66</id>
+                <name>categoryComboB</name>
+            </categoryCombo>
+            <categoryOptions>
+                <categoryOption>
+                    <id>66</id>
+                    <name>categoryOptionB</name>
+                </categoryOption>
+            </categoryOptions>
+        </categoryOptionCombo>
+    </categoryOptionCombos>
+    <categoryCategoryOptionAssociations>
+        <categoryCategoryOptionAssociation>
+            <category>65</category>
+            <categoryOption>65</categoryOption>
+        </categoryCategoryOptionAssociation>
+        <categoryCategoryOptionAssociation>
+            <category>65</category>
+            <categoryOption>66</categoryOption>
+        </categoryCategoryOptionAssociation>
+        <categoryCategoryOptionAssociation>
+            <category>66</category>
+            <categoryOption>68</categoryOption>
+        </categoryCategoryOptionAssociation>
+        <categoryCategoryOptionAssociation>
+            <category>66</category>
+            <categoryOption>67</categoryOption>
+        </categoryCategoryOptionAssociation>
+    </categoryCategoryOptionAssociations>
+    <categoryComboCategoryAssociations>
+        <categoryComboCategoryAssociation>
+            <categoryCombo>65</categoryCombo>
+            <category>66</category>
+        </categoryComboCategoryAssociation>
+        <categoryComboCategoryAssociation>
+            <categoryCombo>65</categoryCombo>
+            <category>65</category>
+        </categoryComboCategoryAssociation>
+        <categoryComboCategoryAssociation>
+            <categoryCombo>66</categoryCombo>
+            <category>65</category>
+        </categoryComboCategoryAssociation>
+    </categoryComboCategoryAssociations>
+    <dataElements>
+        <dataElement>
+            <id>65</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECA</uuid>
+            <name>DataElementA</name>
+            <alternativeName>AlternativeNameA</alternativeName>
+            <shortName>ShortNameA</shortName>
+            <code>CodeA</code>
+            <description>DescriptionA</description>
+            <active>true</active>
+            <type>int</type>
+            <aggregationOperator>sum</aggregationOperator>
+            <categoryCombo>65</categoryCombo>
+        </dataElement>
+        <dataElement>
+            <id>66</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECB</uuid>
+            <name>DataElementB</name>
+            <alternativeName>AlternativeNameB</alternativeName>
+            <shortName>ShortNameB</shortName>
+            <code>CodeB</code>
+            <description>DescriptionB</description>
+            <active>true</active>
+            <type>int</type>
+            <aggregationOperator>sum</aggregationOperator>
+            <categoryCombo>65</categoryCombo>
+        </dataElement>
+        <dataElement>
+            <id>67</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECC</uuid>
+            <name>DataElementC</name>
+            <alternativeName>AlternativeNameC</alternativeName>
+            <shortName>ShortNameC</shortName>
+            <code>CodeC</code>
+            <description>DescriptionC</description>
+            <active>true</active>
+            <type>int</type>
+            <aggregationOperator>sum</aggregationOperator>
+            <categoryCombo>65</categoryCombo>
+        </dataElement>
+    </dataElements>
+    <dataElementGroups>
+        <dataElementGroup>
+            <id>65</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECA</uuid>
+            <name>DataElementGroupA</name>
+        </dataElementGroup>
+        <dataElementGroup>
+            <id>66</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECB</uuid>
+            <name>DataElementGroupB</name>
+        </dataElementGroup>
+        <dataElementGroup>
+            <id>67</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECC</uuid>
+            <name>DataElementGroupC</name>
+        </dataElementGroup>
+    </dataElementGroups>
+    <dataElementGroupMembers>
+        <dataElementGroupMember>
+            <dataElementGroup>65</dataElementGroup>
+            <dataElement>67</dataElement>
+        </dataElementGroupMember>
+        <dataElementGroupMember>
+            <dataElementGroup>65</dataElementGroup>
+            <dataElement>66</dataElement>
+        </dataElementGroupMember>
+        <dataElementGroupMember>
+            <dataElementGroup>65</dataElementGroup>
+            <dataElement>65</dataElement>
+        </dataElementGroupMember>
+        <dataElementGroupMember>
+            <dataElementGroup>66</dataElementGroup>
+            <dataElement>67</dataElement>
+        </dataElementGroupMember>
+        <dataElementGroupMember>
+            <dataElementGroup>66</dataElementGroup>
+            <dataElement>66</dataElement>
+        </dataElementGroupMember>
+        <dataElementGroupMember>
+            <dataElementGroup>66</dataElementGroup>
+            <dataElement>65</dataElement>
+        </dataElementGroupMember>
+        <dataElementGroupMember>
+            <dataElementGroup>67</dataElementGroup>
+            <dataElement>67</dataElement>
+        </dataElementGroupMember>
+        <dataElementGroupMember>
+            <dataElementGroup>67</dataElementGroup>
+            <dataElement>66</dataElement>
+        </dataElementGroupMember>
+        <dataElementGroupMember>
+            <dataElementGroup>67</dataElementGroup>
+            <dataElement>65</dataElement>
+        </dataElementGroupMember>
+    </dataElementGroupMembers>
+    <indicatorTypes>
+        <indicatorType>
+            <id>65</id>
+            <name>IndicatorTypeA</name>
+            <factor>100</factor>
+        </indicatorType>
+        <indicatorType>
+            <id>66</id>
+            <name>IndicatorTypeB</name>
+            <factor>100</factor>
+        </indicatorType>
+        <indicatorType>
+            <id>67</id>
+            <name>IndicatorTypeC</name>
+            <factor>100</factor>
+        </indicatorType>
+    </indicatorTypes>
+    <indicators>
+        <indicator>
+            <id>65</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECA</uuid>
+            <name>IndicatorA</name>
+            <alternativeName>AlternativeNameA</alternativeName>
+            <shortName>ShortNameA</shortName>
+            <code>CodeA</code>
+            <description>DescriptionA</description>
+            <annualized>false</annualized>
+            <indicatorType>65</indicatorType>
+            <numerator>Numerator</numerator>
+            <numeratorDescription>NumeratorDescription</numeratorDescription>
+            <numeratorAggregationOperator>sum</numeratorAggregationOperator>
+            <denominator>Denominator</denominator>
+            <denominatorDescription>DenominatorDescription</denominatorDescription>
+            <denominatorAggregationOperator>sum</denominatorAggregationOperator>
+        </indicator>
+        <indicator>
+            <id>66</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECB</uuid>
+            <name>IndicatorB</name>
+            <alternativeName>AlternativeNameB</alternativeName>
+            <shortName>ShortNameB</shortName>
+            <code>CodeB</code>
+            <description>DescriptionB</description>
+            <annualized>false</annualized>
+            <indicatorType>65</indicatorType>
+            <numerator>Numerator</numerator>
+            <numeratorDescription>NumeratorDescription</numeratorDescription>
+            <numeratorAggregationOperator>sum</numeratorAggregationOperator>
+            <denominator>Denominator</denominator>
+            <denominatorDescription>DenominatorDescription</denominatorDescription>
+            <denominatorAggregationOperator>sum</denominatorAggregationOperator>
+        </indicator>
+        <indicator>
+            <id>67</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECC</uuid>
+            <name>IndicatorC</name>
+            <alternativeName>AlternativeNameC</alternativeName>
+            <shortName>ShortNameC</shortName>
+            <code>CodeC</code>
+            <description>DescriptionC</description>
+            <annualized>false</annualized>
+            <indicatorType>65</indicatorType>
+            <numerator>Numerator</numerator>
+            <numeratorDescription>NumeratorDescription</numeratorDescription>
+            <numeratorAggregationOperator>sum</numeratorAggregationOperator>
+            <denominator>Denominator</denominator>
+            <denominatorDescription>DenominatorDescription</denominatorDescription>
+            <denominatorAggregationOperator>sum</denominatorAggregationOperator>
+        </indicator>
+    </indicators>
+    <indicatorGroups>
+        <indicatorGroup>
+            <id>65</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECA</uuid>
+            <name>IndicatorGroupA</name>
+        </indicatorGroup>
+        <indicatorGroup>
+            <id>66</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECB</uuid>
+            <name>IndicatorGroupB</name>
+        </indicatorGroup>
+        <indicatorGroup>
+            <id>67</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECC</uuid>
+            <name>IndicatorGroupC</name>
+        </indicatorGroup>
+    </indicatorGroups>
+    <indicatorGroupMembers>
+        <indicatorGroupMember>
+            <indicatorGroup>65</indicatorGroup>
+            <indicator>66</indicator>
+        </indicatorGroupMember>
+        <indicatorGroupMember>
+            <indicatorGroup>65</indicatorGroup>
+            <indicator>65</indicator>
+        </indicatorGroupMember>
+        <indicatorGroupMember>
+            <indicatorGroup>65</indicatorGroup>
+            <indicator>67</indicator>
+        </indicatorGroupMember>
+        <indicatorGroupMember>
+            <indicatorGroup>66</indicatorGroup>
+            <indicator>66</indicator>
+        </indicatorGroupMember>
+        <indicatorGroupMember>
+            <indicatorGroup>66</indicatorGroup>
+            <indicator>65</indicator>
+        </indicatorGroupMember>
+        <indicatorGroupMember>
+            <indicatorGroup>66</indicatorGroup>
+            <indicator>67</indicator>
+        </indicatorGroupMember>
+        <indicatorGroupMember>
+            <indicatorGroup>67</indicatorGroup>
+            <indicator>66</indicator>
+        </indicatorGroupMember>
+        <indicatorGroupMember>
+            <indicatorGroup>67</indicatorGroup>
+            <indicator>65</indicator>
+        </indicatorGroupMember>
+        <indicatorGroupMember>
+            <indicatorGroup>67</indicatorGroup>
+            <indicator>67</indicator>
+        </indicatorGroupMember>
+    </indicatorGroupMembers>
+    <dataSets>
+        <dataSet>
+            <id>65</id>
+            <name>DataSetA</name>
+            <periodType>Weekly</periodType>
+        </dataSet>
+        <dataSet>
+            <id>66</id>
+            <name>DataSetB</name>
+            <periodType>Weekly</periodType>
+        </dataSet>
+        <dataSet>
+            <id>67</id>
+            <name>DataSetC</name>
+            <periodType>Weekly</periodType>
+        </dataSet>
+    </dataSets>
+    <dataSetMembers>
+        <dataSetMember>
+            <dataSet>65</dataSet>
+            <dataElement>67</dataElement>
+        </dataSetMember>
+        <dataSetMember>
+            <dataSet>65</dataSet>
+            <dataElement>66</dataElement>
+        </dataSetMember>
+        <dataSetMember>
+            <dataSet>65</dataSet>
+            <dataElement>65</dataElement>
+        </dataSetMember>
+        <dataSetMember>
+            <dataSet>66</dataSet>
+            <dataElement>67</dataElement>
+        </dataSetMember>
+        <dataSetMember>
+            <dataSet>66</dataSet>
+            <dataElement>66</dataElement>
+        </dataSetMember>
+        <dataSetMember>
+            <dataSet>66</dataSet>
+            <dataElement>65</dataElement>
+        </dataSetMember>
+        <dataSetMember>
+            <dataSet>67</dataSet>
+            <dataElement>67</dataElement>
+        </dataSetMember>
+        <dataSetMember>
+            <dataSet>67</dataSet>
+            <dataElement>66</dataElement>
+        </dataSetMember>
+        <dataSetMember>
+            <dataSet>67</dataSet>
+            <dataElement>65</dataElement>
+        </dataSetMember>
+    </dataSetMembers>
+    <organisationUnits>
+        <organisationUnit>
+            <id>65</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECA</uuid>
+            <name>OrganisationUnitA</name>
+            <shortName>ShortNameA</shortName>
+            <code>CodeA</code>
+            <openingDate>1970-01-01</openingDate>
+            <closedDate>1970-01-01</closedDate>
+            <active>true</active>
+            <comment>CommentA</comment>
+            <geoCode>GeoCode</geoCode>
+        </organisationUnit>
+        <organisationUnit>
+            <id>66</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECB</uuid>
+            <name>OrganisationUnitB</name>
+            <shortName>ShortNameB</shortName>
+            <code>CodeB</code>
+            <openingDate>1970-01-01</openingDate>
+            <closedDate>1970-01-01</closedDate>
+            <active>true</active>
+            <comment>CommentB</comment>
+            <geoCode>GeoCode</geoCode>
+        </organisationUnit>
+        <organisationUnit>
+            <id>67</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECC</uuid>
+            <name>OrganisationUnitC</name>
+            <shortName>ShortNameC</shortName>
+            <code>CodeC</code>
+            <openingDate>1970-01-01</openingDate>
+            <closedDate>1970-01-01</closedDate>
+            <active>true</active>
+            <comment>CommentC</comment>
+            <geoCode>GeoCode</geoCode>
+        </organisationUnit>
+    </organisationUnits>
+    <organisationUnitRelationships>
+        <organisationUnitRelationship>
+            <parent>65</parent>
+            <child>66</child>
+        </organisationUnitRelationship>
+        <organisationUnitRelationship>
+            <parent>66</parent>
+            <child>67</child>
+        </organisationUnitRelationship>
+    </organisationUnitRelationships>
+    <organisationUnitGroups>
+        <organisationUnitGroup>
+            <id>65</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECA</uuid>
+            <name>OrganisationUnitGroupA</name>
+        </organisationUnitGroup>
+        <organisationUnitGroup>
+            <id>66</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECB</uuid>
+            <name>OrganisationUnitGroupB</name>
+        </organisationUnitGroup>
+        <organisationUnitGroup>
+            <id>67</id>
+            <uuid>C3C2E28D-9686-4634-93FD-BE3133935ECC</uuid>
+            <name>OrganisationUnitGroupC</name>
+        </organisationUnitGroup>
+    </organisationUnitGroups>
+    <organisationUnitGroupMembers>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>65</organisationUnitGroup>
+            <organisationUnit>66</organisationUnit>
+        </organisationUnitGroupMember>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>65</organisationUnitGroup>
+            <organisationUnit>67</organisationUnit>
+        </organisationUnitGroupMember>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>65</organisationUnitGroup>
+            <organisationUnit>65</organisationUnit>
+        </organisationUnitGroupMember>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>66</organisationUnitGroup>
+            <organisationUnit>66</organisationUnit>
+        </organisationUnitGroupMember>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>66</organisationUnitGroup>
+            <organisationUnit>67</organisationUnit>
+        </organisationUnitGroupMember>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>66</organisationUnitGroup>
+            <organisationUnit>65</organisationUnit>
+        </organisationUnitGroupMember>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>67</organisationUnitGroup>
+            <organisationUnit>66</organisationUnit>
+        </organisationUnitGroupMember>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>67</organisationUnitGroup>
+            <organisationUnit>67</organisationUnit>
+        </organisationUnitGroupMember>
+        <organisationUnitGroupMember>
+            <organisationUnitGroup>67</organisationUnitGroup>
+            <organisationUnit>65</organisationUnit>
+        </organisationUnitGroupMember>
+    </organisationUnitGroupMembers>
+    <groupSets>
+        <groupSet>
+            <id>65</id>
+            <name>OrganisationUnitGroupSetA</name>
+            <description>DescriptionA</description>
+            <compulsory>true</compulsory>
+            <exclusive>true</exclusive>
+        </groupSet>
+        <groupSet>
+            <id>66</id>
+            <name>OrganisationUnitGroupSetB</name>
+            <description>DescriptionB</description>
+            <compulsory>true</compulsory>
+            <exclusive>true</exclusive>
+        </groupSet>
+        <groupSet>
+            <id>67</id>
+            <name>OrganisationUnitGroupSetC</name>
+            <description>DescriptionC</description>
+            <compulsory>true</compulsory>
+            <exclusive>true</exclusive>
+        </groupSet>
+    </groupSets>
+    <groupSetMembers>
+        <groupSetMember>
+            <groupSet>65</groupSet>
+            <organisationUnitGroup>67</organisationUnitGroup>
+        </groupSetMember>
+        <groupSetMember>
+            <groupSet>65</groupSet>
+            <organisationUnitGroup>66</organisationUnitGroup>
+        </groupSetMember>
+        <groupSetMember>
+            <groupSet>65</groupSet>
+            <organisationUnitGroup>65</organisationUnitGroup>
+        </groupSetMember>
+        <groupSetMember>
+            <groupSet>66</groupSet>
+            <organisationUnitGroup>67</organisationUnitGroup>
+        </groupSetMember>
+        <groupSetMember>
+            <groupSet>66</groupSet>
+            <organisationUnitGroup>66</organisationUnitGroup>
+        </groupSetMember>
+        <groupSetMember>
+            <groupSet>66</groupSet>
+            <organisationUnitGroup>65</organisationUnitGroup>
+        </groupSetMember>
+        <groupSetMember>
+            <groupSet>67</groupSet>
+            <organisationUnitGroup>67</organisationUnitGroup>
+        </groupSetMember>
+        <groupSetMember>
+            <groupSet>67</groupSet>
+            <organisationUnitGroup>66</organisationUnitGroup>
+        </groupSetMember>
+        <groupSetMember>
+            <groupSet>67</groupSet>
+            <organisationUnitGroup>65</organisationUnitGroup>
+        </groupSetMember>
+    </groupSetMembers>
+    <validationRules>
+        <validationRule>
+            <name>ValidationRuleA</name>
+            <description>DescriptionA</description>
+            <type>absolute</type>
+            <operator>equal_to</operator>
+            <leftSideExpression>[A.65]+[B.65]</leftSideExpression>
+            <leftSideDescription>DescriptionA</leftSideDescription>
+            <rightSideExpression>[A.65]+[B.65]</rightSideExpression>
+            <rightSideDescription>DescriptionA</rightSideDescription>
+        </validationRule>
+        <validationRule>
+            <name>ValidationRuleB</name>
+            <description>DescriptionB</description>
+            <type>absolute</type>
+            <operator>equal_to</operator>
+            <leftSideExpression>[A.65]+[B.65]</leftSideExpression>
+            <leftSideDescription>DescriptionA</leftSideDescription>
+            <rightSideExpression>[A.65]+[B.65]</rightSideExpression>
+            <rightSideDescription>DescriptionA</rightSideDescription>
+        </validationRule>
+        <validationRule>
+            <name>ValidationRuleC</name>
+            <description>DescriptionC</description>
+            <type>absolute</type>
+            <operator>equal_to</operator>
+            <leftSideExpression>[A.65]+[B.65]</leftSideExpression>
+            <leftSideDescription>DescriptionA</leftSideDescription>
+            <rightSideExpression>[A.65]+[B.65]</rightSideExpression>
+            <rightSideDescription>DescriptionA</rightSideDescription>
+        </validationRule>
+    </validationRules>
+    <periods>
+        <period>
+            <id>65</id>
+            <periodType>Weekly</periodType>
+            <startDate>1999-12-27</startDate>
+            <endDate>2000-01-02</endDate>
+        </period>
+        <period>
+            <id>66</id>
+            <periodType>Weekly</periodType>
+            <startDate>2000-01-03</startDate>
+            <endDate>2000-01-09</endDate>
+        </period>
+        <period>
+            <id>67</id>
+            <periodType>Weekly</periodType>
+            <startDate>2000-01-10</startDate>
+            <endDate>2000-01-16</endDate>
+        </period>
+    </periods>
+</dxf>

=== added file 'dhis-2/dhis-support/dhis-support-system/src/test/resources/Export.xml.gz'
Binary files dhis-2/dhis-support/dhis-support-system/src/test/resources/Export.xml.gz	1970-01-01 00:00:00 +0000 and dhis-2/dhis-support/dhis-support-system/src/test/resources/Export.xml.gz	2009-12-19 15:20:41 +0000 differ
=== added file 'dhis-2/dhis-support/dhis-support-system/src/test/resources/dxfA.zip'
Binary files dhis-2/dhis-support/dhis-support-system/src/test/resources/dxfA.zip	1970-01-01 00:00:00 +0000 and dhis-2/dhis-support/dhis-support-system/src/test/resources/dxfA.zip	2009-12-19 15:20:41 +0000 differ