dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06663
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1847: Improved testing of import/transforms
------------------------------------------------------------
revno: 1847
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Tue 2010-07-13 22:21:23 +0200
message:
Improved testing of import/transforms
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-api/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitTest.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/GML2DXFTest.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/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2010-07-05 17:05:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2010-07-13 20:21:23 +0000
@@ -173,6 +173,23 @@
return collection;
}
+
+ public Collection<String> getAllCoordinates()
+ {
+ Collection<String> collection = new ArrayList<String>();
+
+ if ( coordinates != null && !coordinates.trim().isEmpty() )
+ {
+ Matcher matcher = GML_COORDINATE_PATTERN.matcher( coordinates );
+
+ while ( matcher.find() )
+ {
+ collection.add( matcher.group() );
+ }
+ }
+
+ return collection;
+ }
public void setCoordinatesFromCollection( Collection<String> collection )
{
=== modified file 'dhis-2/dhis-api/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitTest.java'
--- dhis-2/dhis-api/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitTest.java 2010-07-05 17:05:39 +0000
+++ dhis-2/dhis-api/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitTest.java 2010-07-13 20:21:23 +0000
@@ -80,5 +80,16 @@
assertTrue( actual.contains( cleanCoordinatesCollection.get( 0 ) ) );
assertTrue( actual.contains( cleanCoordinatesCollection.get( 1 ) ) );
assertTrue( actual.contains( cleanCoordinatesCollection.get( 2 ) ) );
- }
+ }
+
+ @Test
+ public void testGetCoordinatesAsMap()
+ {
+ OrganisationUnit unit = new OrganisationUnit();
+ unit.setCoordinates( coordinates );
+
+ Collection<String> actual = unit.getAllCoordinates();
+
+ assertEquals( 9, actual.size() );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java 2010-07-13 00:31:39 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFImportServiceTest.java 2010-07-13 20:21:23 +0000
@@ -141,8 +141,6 @@
private final static String SDMXCROSS2DXF = "cross2dxf.xsl";
- private final static String METADATA = "ExportMetaData.xml";
-
private ImportObjectService importObjectService;
private ImportDataValueService importDataValueService;
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/GML2DXFTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/GML2DXFTest.java 2010-07-13 00:31:39 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/GML2DXFTest.java 2010-07-13 20:21:23 +0000
@@ -93,5 +93,8 @@
assertEquals( 9, organisationUnitService.getOrganisationUnitByName( "Port Loko" ).getCoordinatesAsCollection().size() );
assertEquals( 1, organisationUnitService.getOrganisationUnitByName( "Tonkolili" ).getCoordinatesAsCollection().size() );
assertEquals( 2, organisationUnitService.getOrganisationUnitByName( "Western Area" ).getCoordinatesAsCollection().size() );
+
+ assertEquals( 76, organisationUnitService.getOrganisationUnitByName( "Bo" ).getAllCoordinates().size() );
+ //assertEquals( 474, organisationUnitService.getOrganisationUnitByName( "Bonthe" ).getAllCoordinates().size() );
}
}