=== added directory 'dhis-2/dhis-services/dhis-service-integration/errors'
=== added file 'dhis-2/dhis-services/dhis-service-integration/errors/ID-bobs-laptop-45863-1334770249602-0-3'
--- dhis-2/dhis-services/dhis-service-integration/errors/ID-bobs-laptop-45863-1334770249602-0-3 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/errors/ID-bobs-laptop-45863-1334770249602-0-3 2012-06-01 21:56:18 +0000
@@ -0,0 +1,1 @@
+i Bureh Memorial Hospital" lastUpdated="2012-02-17T14:54:39.987+0000" link="http://apps.dhis2.org/dev/api/organisationUnits/BH7rDkWjUqc" internalId="255019" id="BH7rDkWjUqc"/>
\ No newline at end of file
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/DefaultIntegrationService.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/DefaultIntegrationService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/DefaultIntegrationService.java 2012-06-01 21:56:18 +0000
@@ -0,0 +1,68 @@
+package org.hisp.dhis.integration;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+import java.io.InputStream;
+import org.apache.camel.CamelContext;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import org.hisp.dhis.integration.routes.SDMXDataIn;
+import org.hisp.dhis.integration.routes.XMLDataIn;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ *
+ * @author bobj
+ */
+public class DefaultIntegrationService implements IntegrationService
+{
+ @Autowired
+ CamelContext camelContext;
+
+ @EndpointInject(uri = XMLDataIn.XMLDATA_IN)
+ private ProducerTemplate xmlIn;
+
+ @EndpointInject(uri = SDMXDataIn.SDMXDATA_IN)
+ private ProducerTemplate sdmxIn;
+
+
+ @Override
+ public ImportSummary importXMLDataValueSet( InputStream in, ImportOptions importOptions )
+ {
+ return (ImportSummary) xmlIn.requestBodyAndHeader( in, "ImportOptions", importOptions);
+ }
+
+ @Override
+ public ImportSummary importSDMXDataValueSet( InputStream in, ImportOptions importOptions )
+ {
+ return (ImportSummary) sdmxIn.requestBodyAndHeader( in, "ImportOptions", importOptions);
+ }
+
+}
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/IntegrationService.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/IntegrationService.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/IntegrationService.java 2012-06-01 21:56:18 +0000
@@ -0,0 +1,43 @@
+package org.hisp.dhis.integration;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+import java.io.InputStream;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+
+/**
+ *
+ * @author bobj
+ */
+public interface IntegrationService
+{
+ ImportSummary importXMLDataValueSet(InputStream in, ImportOptions options);
+
+ ImportSummary importSDMXDataValueSet(InputStream in, ImportOptions options);
+}
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java 2012-04-16 15:48:50 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataEndpoint.java 2012-06-01 21:56:18 +0000
@@ -72,6 +72,16 @@
importOptions.setDryRun( dryRun );
}
+ public void setDataElementIdScheme( String dataElementIdScheme )
+ {
+ importOptions.setDataElementIdScheme( dataElementIdScheme );
+ }
+
+ public void setOrgUnitIdScheme( String orgUnitIdScheme )
+ {
+ importOptions.setOrgUnitIdScheme( orgUnitIdScheme );
+ }
+
public Dxf2DataEndpoint( String uri, Dxf2Component component, DataValueSetService dataValueSetService )
{
super( uri, component );
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataProducer.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataProducer.java 2012-04-16 15:40:44 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/components/Dxf2DataProducer.java 2012-06-01 21:56:18 +0000
@@ -54,6 +54,8 @@
ImportSummary summary = endpoint.getDataValueSetService().saveDataValueSet( (InputStream)exchange.getIn().getBody(),
endpoint.getImportOptions() );
- exchange.getOut().setBody(JacksonUtils.toXmlAsString( summary ) );
+ //exchange.getOut().setBody(JacksonUtils.toXmlAsString( summary ) );
+ exchange.getOut().setBody( summary );
+ log.info( this.getEndpoint().getEndpointUri() + " : " + JacksonUtils.toXmlAsString(exchange.getOut().getBody()) );
}
}
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/SDMXDataIn.java 2012-06-01 21:56:18 +0000
@@ -0,0 +1,63 @@
+package org.hisp.dhis.integration.routes;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.model.DescriptionDefinition;
+
+/**
+ * SDMXDataIn route takes an SDMX cross-sectional message, transforms to dxf2 datavalueset
+ * and sends to dxf2 endpoint
+ *
+ * @author bobj
+ */
+public class SDMXDataIn extends RouteBuilder
+{
+
+ // DataInput endpoint
+
+ public static final String SDMXDATA_IN = "direct:sdmxDataIn";
+
+ // Route description texts
+
+ public static final String SDMXDATA_IN_DESC = "Internal: SDMX Data to DXF2 Input";
+
+
+ @Override
+ public void configure() throws Exception
+ {
+ DescriptionDefinition desc = new DescriptionDefinition();
+ desc.setText( "SDMX Data to DXF2 Input");
+
+ from(SDMXDATA_IN).
+ convertBodyTo( java.lang.String.class, "UTF-8" ).to( "log:org.hisp.dhis.integration?level=INFO").
+ to("xslt:transform/cross2dxf2.xsl").convertBodyTo( java.io.InputStream.class).
+ to("dhis2:data?orgUnitIdScheme=CODE&dataElementIdScheme=CODE&importStrategy=NEW_AND_UPDATES").
+ setDescription( desc );
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java'
--- dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/java/org/hisp/dhis/integration/routes/XMLDataIn.java 2012-06-01 21:56:18 +0000
@@ -0,0 +1,70 @@
+package org.hisp.dhis.integration.routes;
+
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.builder.xml.Namespaces;
+import org.apache.camel.model.DescriptionDefinition;
+
+/**
+ * XMLDataIn route implements a Content Based Routing pattern
+ *
+ *
+ * @author bobj
+ */
+public class XMLDataIn extends RouteBuilder
+{
+
+ // DataInput endpoint
+
+ public static final String XMLDATA_IN = "direct:xmlDataIn";
+
+ // Route description texts
+
+ public static final String XMLDATA_IN_DESC = "Internal: XML Data to DXF2 Input";
+
+ // Route definitions
+ @Override
+ public void configure() throws Exception
+ {
+ // add namespaces to the XPath context
+ Namespaces ns = new Namespaces( "m", "http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message");
+ ns.add( "d", "http://dhis2.org/schema/dxf/2.0");
+
+ DescriptionDefinition xmlDesc = new DescriptionDefinition();
+ xmlDesc.setText( XMLDATA_IN_DESC);
+
+ from(XMLDATA_IN).convertBodyTo(java.lang.String.class, "UTF-8")
+ .choice()
+ .when().xpath( "boolean(/d:dataValueSet)", ns).convertBodyTo( java.io.InputStream.class).to("dhis2:data")
+ .when().xpath( "boolean(/m:CrossSectionalData)", ns).to("direct:sdmxDataIn")
+ .otherwise().to("log:org.hisp.dhis.integration?level=DEBUG" )
+ .end()
+ .setDescription( xmlDesc );
+ }
+}
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-integration/src/main/resources/META-INF/dhis/beans.xml 2012-04-16 21:39:05 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/resources/META-INF/dhis/beans.xml 2012-06-01 21:56:18 +0000
@@ -7,18 +7,24 @@
+
+
-
+
+
org.hisp.dhis.integration.routes
**.*Excluded*
**.*
+
+
+
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl'
--- dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl 2012-04-08 11:39:56 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/main/resources/transform/cross2dxf2.xsl 2012-06-01 21:56:18 +0000
@@ -16,10 +16,10 @@
-
+
-
+
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java'
--- dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/java/org/hisp/dhis/integration/RoutesTest.java 2012-06-01 21:56:18 +0000
@@ -0,0 +1,160 @@
+package org.hisp.dhis.integration;
+
+/*
+ * Copyright (c) 2012, 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.
+ */
+
+import static junit.framework.Assert.assertNotNull;
+import static org.hisp.dhis.common.IdentifiableObject.IdentifiableProperty.*;
+import static org.hisp.dhis.importexport.ImportStrategy.*;
+
+
+import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+import org.hisp.dhis.dxf2.metadata.ImportOptions;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.period.MonthlyPeriodType;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodService;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+
+public class RoutesTest
+ extends DhisTest
+{
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private IntegrationService integrationService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
+ @Autowired
+ private CompleteDataSetRegistrationService registrationService;
+
+ private DataElement deA;
+ private DataElement deB;
+ private DataElement deC;
+ private DataSet dsA;
+ private OrganisationUnit ouA;
+ private OrganisationUnit ouB;
+ private Period peA;
+ private Period peB;
+ private DataElementCategoryOptionCombo optionComboA;
+
+ @Override
+ public boolean emptyDatabaseAfterTest()
+ {
+ return true;
+ }
+
+ @Override
+ public void setUpTest()
+ {
+ deA = createDataElement( 'A' );
+ deB = createDataElement( 'B' );
+ deC = createDataElement( 'C' );
+ dsA = createDataSet( 'A', new MonthlyPeriodType() );
+ ouA = createOrganisationUnit( 'A' );
+ ouB = createOrganisationUnit( 'B' );
+ peA = createPeriod( getDate( 2012, 1, 1 ), getDate( 2012, 1, 31 ) );
+ peB = createPeriod( getDate( 2012, 2, 1 ), getDate( 2012, 2, 29 ) );
+ optionComboA = categoryService.getDefaultDataElementCategoryOptionCombo();
+
+ deA.setUid( "f7n9E0hX8qk" );
+ deB.setUid( "Ix2HsbDMLea" );
+ deC.setUid( "eY5ehpbEsB7" );
+ dsA.setUid( "pBOMPrpg1QX" );
+ ouA.setUid( "DiszpKrYNg8" );
+ ouB.setUid( "BdfsJfj87js" );
+
+ deA.setCode( "DE_A" );
+ deB.setCode( "DE_B" );
+ deC.setCode( "DE_C" );
+ dsA.setCode( "DS_A" );
+ ouA.setCode( "OU_A" );
+ ouB.setCode( "OU_B" );
+
+ dataElementService.addDataElement( deA );
+ dataElementService.addDataElement( deB );
+ dataElementService.addDataElement( deC );
+ dataSetService.addDataSet( dsA );
+ organisationUnitService.addOrganisationUnit( ouA );
+ organisationUnitService.addOrganisationUnit( ouB );
+ periodService.addPeriod( peA );
+ periodService.addPeriod( peB );
+ }
+
+ @Test
+ public void testImportDataValueSetSDMX()
+ throws Exception
+ {
+ ImportOptions options = new ImportOptions( CODE, CODE, false, NEW_AND_UPDATES, false );
+ ImportSummary summary = integrationService.importSDMXDataValueSet( new ClassPathResource( "data/sdmx_test.xml" ).getInputStream(),options );
+
+ assertNotNull( summary );
+ assertNotNull( summary.getDataValueCount() );
+
+ }
+
+ @Test
+ public void testImportDataValueSetXML()
+ throws Exception
+ {
+ ImportOptions options = new ImportOptions( CODE, CODE, false, NEW_AND_UPDATES, false );
+ ImportSummary summary = integrationService.importXMLDataValueSet( new ClassPathResource( "data/dataValueSetA.xml" ).getInputStream(),options );
+
+ assertNotNull( summary );
+ assertNotNull( summary.getDataValueCount() );
+
+ }
+
+
+}
=== added directory 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/data'
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/dataValueSetA.xml'
--- dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/dataValueSetA.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/dataValueSetA.xml 2012-06-01 21:56:18 +0000
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/sdmx_test.xml'
--- dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/sdmx_test.xml 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/resources/data/sdmx_test.xml 2012-06-01 21:56:18 +0000
@@ -0,0 +1,27 @@
+
+
+
+
+ SDMX-HD-CSD
+ false
+ false
+ Monthly Facility Report
+ 2012-05-25
+
+ DDU
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
=== added file 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/log4j.properties'
--- dhis-2/dhis-services/dhis-service-integration/src/test/resources/log4j.properties 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/resources/log4j.properties 2012-06-01 21:56:18 +0000
@@ -0,0 +1,12 @@
+
+# Configuration file for log4j
+
+# Log to console setup
+log4j.appender.console = org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout = org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern = * %-5p %d{ABSOLUTE} %m (%F [%t])%n
+
+# Categories (order: DEBUG, INFO, WARN, ERROR, FATAL)
+log4j.rootCategory = WARN, console
+log4j.category.org.hisp.dhis = INFO, console
+log4j.category.smslib = INFO
\ No newline at end of file
=== modified file 'dhis-2/dhis-services/dhis-service-integration/src/test/resources/test-context.xml'
--- dhis-2/dhis-services/dhis-service-integration/src/test/resources/test-context.xml 2012-04-16 15:12:08 +0000
+++ dhis-2/dhis-services/dhis-service-integration/src/test/resources/test-context.xml 2012-06-01 21:56:18 +0000
@@ -9,6 +9,8 @@
+
+