← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17054: Spring resource for loading files

 

------------------------------------------------------------
revno: 17054
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-10-10 22:26:12 +0200
message:
  Spring resource for loading files
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/gml/GmlImportServiceTest.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-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/gml/GmlImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/gml/GmlImportServiceTest.java	2014-10-10 19:38:58 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/gml/GmlImportServiceTest.java	2014-10-10 20:26:12 +0000
@@ -31,6 +31,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Collection;
 import java.util.HashMap;
@@ -39,6 +40,7 @@
 import org.hisp.dhis.dxf2.metadata.MetaData;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.junit.Test;
+import org.springframework.core.io.ClassPathResource;
 
 /**
  * @author Halvdan Hoem Grelland
@@ -52,12 +54,11 @@
 
     @Override
     public void setUpTest()
+        throws IOException
     {
-        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
         gmlImportService = (GmlImportService) getBean( GmlImportService.ID );
 
-        inputStream = classLoader.getResourceAsStream( "gmlOrgUnits.gml" );
+        inputStream = new ClassPathResource( "gmlOrgUnits.gml" ).getInputStream();        
     }
 
     @Test