=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java 2014-10-07 13:46:29 +0000 @@ -33,9 +33,9 @@ import static org.junit.Assert.assertTrue; import org.hisp.dhis.common.Grid; -import org.hisp.dhis.period.PeriodService; import org.junit.Ignore; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author joakibj, briane, eivinhb @@ -46,17 +46,15 @@ public class DataBrowserServiceTest extends DataBrowserTest { + @Autowired private DataBrowserGridService dataBrowserService; - + private boolean isZeroAdded; @Override public void setUpTest() throws Exception { - dataBrowserService = (DataBrowserGridService) getBean( DataBrowserGridService.ID ); - periodService = (PeriodService) getBean( PeriodService.ID ); - super.setUpDataBrowserTest(); } === modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserStoreTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserStoreTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserStoreTest.java 2014-10-07 13:46:29 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.system.grid.ListGrid; import org.junit.Ignore; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import static org.junit.Assert.*; @@ -45,6 +46,7 @@ public class DataBrowserStoreTest extends DataBrowserTest { + @Autowired private DataBrowserGridStore dataBrowserStore; private boolean isZeroAdded; @@ -53,8 +55,6 @@ public void setUpTest() throws Exception { - dataBrowserStore = (DataBrowserGridStore) getBean( DataBrowserGridStore.ID ); - super.setUpDataBrowserTest(); } === modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserTest.java 2014-10-07 13:46:29 +0000 @@ -54,6 +54,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.period.PeriodType; +import org.springframework.beans.factory.annotation.Autowired; /** * @author joakibj, briane, eivinhb @@ -113,33 +114,42 @@ protected MockI18nFormat mockFormat; + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private IndicatorService indicatorService; + + @Autowired + private PeriodService periodService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private OrganisationUnitGroupService organisationUnitGroupService; + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private DataSetService dataSetService; + public void setUpDataBrowserTest() throws Exception { mockI18n = new MockI18n(); mockFormat = new MockI18nFormat(); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - dataSetService = (DataSetService) getBean( DataSetService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - dataValueService = (DataValueService) getBean( DataValueService.ID ); - - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - - organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID ); - + categoryCombo = categoryService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME ); categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo(); + // --------------------------------------------------------------------- // Setup identifier Collections // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java 2014-04-27 21:52:33 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java 2014-10-07 13:46:29 +0000 @@ -51,6 +51,7 @@ import org.hisp.dhis.period.MonthlyPeriodType; import org.hisp.dhis.period.QuarterlyPeriodType; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -59,8 +60,24 @@ public class DataIntegrityServiceTest extends DhisTest { + @Autowired private DataIntegrityService dataIntegrityService; - + + @Autowired + private DataElementService dataElementService; + + @Autowired + private IndicatorService indicatorService; + + @Autowired + private DataSetService dataSetService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private OrganisationUnitGroupService organisationUnitGroupService; + private DataElement elementA; private DataElement elementB; private DataElement elementC; @@ -99,17 +116,6 @@ public void setUpTest() { // --------------------------------------------------------------------- - // Services - // --------------------------------------------------------------------- - - dataIntegrityService = (DataIntegrityService) getBean( DataIntegrityService.ID ); - dataElementService = (DataElementService) getBean( DataElementService.ID ); - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - dataSetService = (DataSetService) getBean( DataSetService.ID ); - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID ); - - // --------------------------------------------------------------------- // Objects // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/maintenance/MaintenanceStoreTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/maintenance/MaintenanceStoreTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/maintenance/MaintenanceStoreTest.java 2014-10-07 13:46:29 +0000 @@ -31,6 +31,7 @@ import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.dataelement.DataElementService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -39,8 +40,12 @@ public class MaintenanceStoreTest extends DhisSpringTest { + @Autowired private MaintenanceService maintenanceService; + @Autowired + private DataElementService dataElementService; + // ------------------------------------------------------------------------- // Fixture // ------------------------------------------------------------------------- @@ -48,11 +53,7 @@ @Override public void setUpTest() { - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - maintenanceService = (MaintenanceService) getBean( MaintenanceService.ID ); - - dataElementService.addDataElement( createDataElement( 'A' ) ); + dataElementService.addDataElement( createDataElement( 'A' ) ); } // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/resourcetable/ResourceTableServiceTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/resourcetable/ResourceTableServiceTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/resourcetable/ResourceTableServiceTest.java 2014-10-07 13:46:29 +0000 @@ -30,6 +30,7 @@ import org.hisp.dhis.DhisSpringTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -38,15 +39,8 @@ public class ResourceTableServiceTest extends DhisSpringTest { - // ------------------------------------------------------------------------- - // Fixture - // ------------------------------------------------------------------------- - - @Override - public void setUpTest() - { - resourceTableService = (ResourceTableService) getBean( ResourceTableService.ID ); - } + @Autowired + private ResourceTableService resourceTableService; // ------------------------------------------------------------------------- // Tests === modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/sqlview/SqlViewServiceTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/sqlview/SqlViewServiceTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/sqlview/SqlViewServiceTest.java 2014-10-07 13:46:29 +0000 @@ -38,6 +38,7 @@ import org.hisp.dhis.DhisTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Dang Duy Hieu @@ -46,6 +47,7 @@ public class SqlViewServiceTest extends DhisTest { + @Autowired private SqlViewService sqlViewService; protected static final String SQL1 = "SELECT * FROM _categorystructure;; ; ;;; ;; ; "; @@ -59,13 +61,7 @@ protected static final String SQL4 = "SELECT de.name, dv.sourceid, dv.value, p.startdate " + "FROM dataelement AS de, datavalue AS dv, period AS p " + "WHERE de.dataelementid=dv.dataelementid " + "AND dv.periodid=p.periodid LIMIT 10"; - - @Override - public void setUpTest() - { - sqlViewService = (SqlViewService) getBean( SqlViewService.ID ); - } - + // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/statistics/StatisticsProviderTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/statistics/StatisticsProviderTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/statistics/StatisticsProviderTest.java 2014-10-07 13:46:29 +0000 @@ -37,6 +37,7 @@ import org.hisp.dhis.common.Objects; import org.hisp.dhis.dataelement.DataElementService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -45,8 +46,12 @@ public class StatisticsProviderTest extends DhisSpringTest { + @Autowired private StatisticsProvider statisticsProvider; + @Autowired + private DataElementService dataElementService; + // ------------------------------------------------------------------------- // Fixture // ------------------------------------------------------------------------- @@ -54,14 +59,10 @@ @Override public void setUpTest() { - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - statisticsProvider = (StatisticsProvider) getBean( StatisticsProvider.ID ); - dataElementService.addDataElement( createDataElement( 'A' ) ); dataElementService.addDataElement( createDataElement( 'B' ) ); dataElementService.addDataElement( createDataElement( 'C' ) ); - + dataElementService.addDataElementGroup( createDataElementGroup( 'A' ) ); dataElementService.addDataElementGroup( createDataElementGroup( 'B' ) ); } @@ -74,7 +75,7 @@ public void testGetDataElementObjectCount() { Map counts = statisticsProvider.getObjectCounts(); - + assertNotNull( counts ); assertEquals( new Integer( 3 ), counts.get( Objects.DATAELEMENT ) ); } @@ -83,7 +84,7 @@ public void testGetDataElementGroupObjectCounts() { Map counts = statisticsProvider.getObjectCounts(); - + assertNotNull( counts ); assertEquals( new Integer( 2 ), counts.get( Objects.DATAELEMENTGROUP ) ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeServiceTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeServiceTest.java 2014-10-07 13:46:29 +0000 @@ -29,6 +29,8 @@ */ import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + import static org.junit.Assert.*; import org.hisp.dhis.DhisSpringTest; @@ -39,14 +41,9 @@ public class AttributeServiceTest extends DhisSpringTest { + @Autowired private AttributeService attributeService; - @Override - protected void setUpTest() - { - attributeService = (AttributeService) getBean( "org.hisp.dhis.attribute.AttributeService" ); - } - @Test public void testAddAttribute() { === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeStoreTest.java 2014-10-07 13:46:29 +0000 @@ -29,6 +29,8 @@ */ import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + import static org.junit.Assert.*; import org.hisp.dhis.DhisSpringTest; @@ -36,6 +38,7 @@ public class AttributeStoreTest extends DhisSpringTest { + @Autowired private AttributeStore attributeStore; private Attribute attribute1; @@ -45,8 +48,6 @@ @Override protected void setUpTest() { - attributeStore = (AttributeStore) getBean( "org.hisp.dhis.attribute.AttributeStore" ); - attribute1 = new Attribute(); attribute1.setName( "attribute_simple" ); attribute1.setValueType( "string" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.java 2014-04-27 20:11:53 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueServiceTest.java 2014-10-07 13:46:29 +0000 @@ -29,6 +29,8 @@ */ import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + import static org.junit.Assert.*; import org.hisp.dhis.DhisSpringTest; @@ -39,6 +41,7 @@ public class AttributeValueServiceTest extends DhisSpringTest { + @Autowired private AttributeService attributeService; private AttributeValue attributeValue1; @@ -48,8 +51,6 @@ @Override protected void setUpTest() { - attributeService = (AttributeService) getBean( "org.hisp.dhis.attribute.AttributeService" ); - attributeValue1 = new AttributeValue( "value 1" ); attributeValue2 = new AttributeValue( "value 2" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java 2014-10-07 13:46:29 +0000 @@ -28,28 +28,31 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import javax.annotation.Resource; import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.common.GenericStore; +import org.junit.Test; public class AttributeValueStoreTest extends DhisSpringTest { + @Resource(name="org.hisp.dhis.attribute.AttributeValueStore") private GenericStore attributeValueStore; - + + @Resource(name="org.hisp.dhis.attribute.AttributeStore") + private AttributeStore attributeStore; + private AttributeValue attributeValue1; private AttributeValue attributeValue2; @Override - @SuppressWarnings("unchecked") protected void setUpTest() { - AttributeStore attributeStore = (AttributeStore) getBean( "org.hisp.dhis.attribute.AttributeStore" ); - attributeValueStore = (GenericStore) getBean( "org.hisp.dhis.attribute.AttributeValueStore" ); - Attribute attribute1 = new Attribute(); attribute1.setName( "attribute_simple" ); attribute1.setValueType( "string" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/cofiguration/ConfigurationServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/cofiguration/ConfigurationServiceTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/cofiguration/ConfigurationServiceTest.java 2014-10-07 13:46:29 +0000 @@ -36,6 +36,7 @@ import org.hisp.dhis.user.UserGroupService; import org.hisp.dhis.user.UserService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import static org.junit.Assert.*; @@ -45,22 +46,15 @@ public class ConfigurationServiceTest extends DhisSpringTest { + @Autowired private UserService userService; + @Autowired private UserGroupService userGroupService; + @Autowired private ConfigurationService configurationService; - @Override - public void setUpTest() - { - userService = (UserService) getBean( UserService.ID ); - - userGroupService = (UserGroupService) getBean( UserGroupService.ID ); - - configurationService = (ConfigurationService) getBean( ConfigurationService.ID ); - } - @Test public void testConfiguration() { === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.java 2014-10-02 09:36:33 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/common/IdentifiableObjectManagerTest.java 2014-10-07 13:46:29 +0000 @@ -67,12 +67,18 @@ @Autowired private DataElementService dataElementService; - + + @Autowired + private IdentifiableObjectManager _identifiableObjectManager; + + @Autowired + private UserService _userService; + @Override protected void setUpTest() throws Exception { - identifiableObjectManager = (IdentifiableObjectManager) getBean( IdentifiableObjectManager.ID ); - userService = (UserService) getBean( UserService.ID ); + this.identifiableObjectManager = _identifiableObjectManager; + this.userService = _userService; } @Test === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/concept/ConceptTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/concept/ConceptTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/concept/ConceptTest.java 2014-10-07 13:46:29 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.dataelement.DataElementCategory; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryService; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Dang Duy Hieu @@ -43,8 +44,12 @@ public abstract class ConceptTest extends DhisSpringTest { + @Autowired protected ConceptService conceptService; - + + @Autowired + protected DataElementCategoryService categoryService; + protected DataElementCategoryOption categoryOptionA; protected DataElementCategoryOption categoryOptionB; @@ -66,10 +71,6 @@ public void setUpConceptTest() throws Exception { - conceptService = (ConceptService) getBean( ConceptService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - // --------------------------------------------------------------------- // Setup Default Concept // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/constant/ConstantServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/constant/ConstantServiceTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/constant/ConstantServiceTest.java 2014-10-07 13:46:29 +0000 @@ -38,6 +38,7 @@ import org.hisp.dhis.DhisSpringTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Dang Duy Hieu @@ -46,11 +47,9 @@ public class ConstantServiceTest extends DhisSpringTest { - public void setUpTest() - { - constantService = (ConstantService) getBean( ConstantService.ID ); - } - + @Autowired + private ConstantService constantService; + // ------------------------------------------------------------------------- // Supportive methods // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/DataAnalysisStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/DataAnalysisStoreTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/DataAnalysisStoreTest.java 2014-10-07 13:46:29 +0000 @@ -48,6 +48,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -55,7 +56,26 @@ public class DataAnalysisStoreTest extends DhisSpringTest { + @Autowired private DataAnalysisStore dataAnalysisStore; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private DataSetService dataSetService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private PeriodService periodService; private DataElement dataElementA; private DataElement dataElementB; @@ -87,20 +107,6 @@ @Override public void setUpTest() { - dataAnalysisStore = (DataAnalysisStore) getBean( DataAnalysisStore.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - dataSetService = (DataSetService) getBean( DataSetService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - - dataValueService = (DataValueService) getBean( DataValueService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - categoryCombo = categoryService.getDefaultDataElementCategoryCombo(); categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisServiceTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisServiceTest.java 2014-10-07 13:46:29 +0000 @@ -35,6 +35,8 @@ import java.util.HashSet; import java.util.Set; +import javax.annotation.Resource; + import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; @@ -54,6 +56,7 @@ import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.system.util.ListUtils; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author eirikmi @@ -62,10 +65,30 @@ public class MinMaxOutlierAnalysisServiceTest extends DhisSpringTest { + @Resource( name = "org.hisp.dhis.dataanalysis.MinMaxOutlierAnalysisService" ) private DataAnalysisService minMaxOutlierAnalysisService; + @Autowired private MinMaxDataElementService minMaxDataElementService; + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private DataSetService dataSetService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private PeriodService periodService; + private DataElement dataElementA; private DataElement dataElementB; private DataElement dataElementC; @@ -105,22 +128,6 @@ public void setUpTest() throws Exception { - minMaxOutlierAnalysisService = (DataAnalysisService) getBean( "org.hisp.dhis.dataanalysis.MinMaxOutlierAnalysisService" ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - minMaxDataElementService = (MinMaxDataElementService) getBean( MinMaxDataElementService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - dataSetService = (DataSetService) getBean( DataSetService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - - dataValueService = (DataValueService) getBean( DataValueService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - categoryCombo = categoryService.getDefaultDataElementCategoryCombo(); categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/StdDevOutlierAnalysisServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/StdDevOutlierAnalysisServiceTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/StdDevOutlierAnalysisServiceTest.java 2014-10-07 13:46:29 +0000 @@ -36,6 +36,8 @@ import java.util.HashSet; import java.util.Set; +import javax.annotation.Resource; + import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.dataelement.DataElement; import org.hisp.dhis.dataelement.DataElementCategoryCombo; @@ -53,6 +55,7 @@ import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.system.util.ListUtils; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -61,14 +64,37 @@ public class StdDevOutlierAnalysisServiceTest extends DhisSpringTest { + @Resource( name = "org.hisp.dhis.dataanalysis.StdDevOutlierAnalysisService" ) private DataAnalysisService stdDevOutlierAnalysisService; + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private DataSetService dataSetService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private PeriodService periodService; + private DataElement dataElementA; + private DataElement dataElementB; + private DataElement dataElementC; + private DataElement dataElementD; private DataValue dataValueA; + private DataValue dataValueB; private Set dataElementsA = new HashSet<>(); @@ -78,18 +104,27 @@ private DataElementCategoryOptionCombo categoryOptionCombo; private Period periodA; + private Period periodB; - private Period periodC; - private Period periodD; - private Period periodE; - private Period periodF; + + private Period periodC; + + private Period periodD; + + private Period periodE; + + private Period periodF; + private Period periodG; + private Period periodH; + private Period periodI; + private Period periodJ; private OrganisationUnit organisationUnitA; - + // ---------------------------------------------------------------------- // Fixture // ---------------------------------------------------------------------- @@ -97,20 +132,6 @@ @Override public void setUpTest() { - stdDevOutlierAnalysisService = (DataAnalysisService) getBean( "org.hisp.dhis.dataanalysis.StdDevOutlierAnalysisService" ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - dataSetService = (DataSetService) getBean( DataSetService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - - dataValueService = (DataValueService) getBean( DataValueService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - categoryCombo = categoryService.getDefaultDataElementCategoryCombo(); dataElementA = createDataElement( 'A', categoryCombo ); @@ -143,7 +164,7 @@ organisationUnitService.addOrganisationUnit( organisationUnitA ); } - + // ---------------------------------------------------------------------- // Business logic tests // ---------------------------------------------------------------------- @@ -154,14 +175,22 @@ dataValueA = createDataValue( dataElementA, periodI, organisationUnitA, "71", categoryOptionCombo ); dataValueB = createDataValue( dataElementA, periodJ, organisationUnitA, "-71", categoryOptionCombo ); - dataValueService.addDataValue( createDataValue( dataElementA, periodA, organisationUnitA, "5", categoryOptionCombo ) ); - dataValueService.addDataValue( createDataValue( dataElementA, periodB, organisationUnitA, "-5", categoryOptionCombo ) ); - dataValueService.addDataValue( createDataValue( dataElementA, periodC, organisationUnitA, "5", categoryOptionCombo ) ); - dataValueService.addDataValue( createDataValue( dataElementA, periodD, organisationUnitA, "-5", categoryOptionCombo ) ); - dataValueService.addDataValue( createDataValue( dataElementA, periodE, organisationUnitA, "10", categoryOptionCombo ) ); - dataValueService.addDataValue( createDataValue( dataElementA, periodF, organisationUnitA, "-10", categoryOptionCombo ) ); - dataValueService.addDataValue( createDataValue( dataElementA, periodG, organisationUnitA, "13", categoryOptionCombo ) ); - dataValueService.addDataValue( createDataValue( dataElementA, periodH, organisationUnitA, "-13", categoryOptionCombo ) ); + dataValueService.addDataValue( createDataValue( dataElementA, periodA, organisationUnitA, "5", + categoryOptionCombo ) ); + dataValueService.addDataValue( createDataValue( dataElementA, periodB, organisationUnitA, "-5", + categoryOptionCombo ) ); + dataValueService.addDataValue( createDataValue( dataElementA, periodC, organisationUnitA, "5", + categoryOptionCombo ) ); + dataValueService.addDataValue( createDataValue( dataElementA, periodD, organisationUnitA, "-5", + categoryOptionCombo ) ); + dataValueService.addDataValue( createDataValue( dataElementA, periodE, organisationUnitA, "10", + categoryOptionCombo ) ); + dataValueService.addDataValue( createDataValue( dataElementA, periodF, organisationUnitA, "-10", + categoryOptionCombo ) ); + dataValueService.addDataValue( createDataValue( dataElementA, periodG, organisationUnitA, "13", + categoryOptionCombo ) ); + dataValueService.addDataValue( createDataValue( dataElementA, periodH, organisationUnitA, "-13", + categoryOptionCombo ) ); dataValueService.addDataValue( dataValueA ); dataValueService.addDataValue( dataValueB ); @@ -172,14 +201,15 @@ periods.add( periodA ); periods.add( periodE ); - Collection values = stdDevOutlierAnalysisService.analyse( ListUtils.getCollection( organisationUnitA ), dataElementsA, periods, stdDevFactor ); + Collection values = stdDevOutlierAnalysisService.analyse( + ListUtils.getCollection( organisationUnitA ), dataElementsA, periods, stdDevFactor ); double lowerBound = -34.51 * stdDevFactor; double upperBound = 34.51 * stdDevFactor; DeflatedDataValue valueA = new DeflatedDataValue( dataValueA ); DeflatedDataValue valueB = new DeflatedDataValue( dataValueB ); - + assertEquals( 1, values.size() ); assertTrue( values.contains( valueA ) ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataapproval/DataApprovalServiceTest.java 2014-10-07 13:46:29 +0000 @@ -84,6 +84,12 @@ @Autowired private OrganisationUnitService organisationUnitService; + + @Autowired + protected IdentifiableObjectManager _identifiableObjectManager; + + @Autowired + protected UserService _userService; // ------------------------------------------------------------------------- // Supporting data @@ -218,12 +224,12 @@ // ------------------------------------------------------------------------- // Set up/tear down // ------------------------------------------------------------------------- - + @Override public void setUpTest() throws Exception { - identifiableObjectManager = (IdentifiableObjectManager) getBean( IdentifiableObjectManager.ID ); - userService = (UserService) getBean( UserService.ID ); + identifiableObjectManager = _identifiableObjectManager; + userService = _userService; // --------------------------------------------------------------------- // Add supporting data === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datadictionary/DataDictionaryServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datadictionary/DataDictionaryServiceTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datadictionary/DataDictionaryServiceTest.java 2014-10-07 13:46:29 +0000 @@ -35,6 +35,7 @@ import org.hisp.dhis.indicator.IndicatorService; import org.hisp.dhis.indicator.IndicatorType; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import java.util.Collection; import java.util.List; @@ -48,7 +49,14 @@ public class DataDictionaryServiceTest extends DhisSpringTest { + @Autowired private DataDictionaryService dataDictionaryService; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private IndicatorService indicatorService; private DataDictionary dataDictionaryA; private DataDictionary dataDictionaryB; @@ -69,12 +77,6 @@ public void setUpTest() throws Exception { - dataDictionaryService = (DataDictionaryService) getBean( DataDictionaryService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - dataDictionaryA = createDataDictionary( 'A' ); dataDictionaryB = createDataDictionary( 'B' ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datadictionary/DataDictionaryStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datadictionary/DataDictionaryStoreTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datadictionary/DataDictionaryStoreTest.java 2014-10-07 13:46:29 +0000 @@ -35,6 +35,8 @@ import java.util.Collection; +import javax.annotation.Resource; + import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.hisp.dhis.dataelement.DataElement; @@ -43,17 +45,24 @@ import org.hisp.dhis.indicator.IndicatorService; import org.hisp.dhis.indicator.IndicatorType; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland * @version $Id$ */ -@SuppressWarnings( "unchecked" ) public class DataDictionaryStoreTest extends DhisSpringTest { + @Resource( name = "org.hisp.dhis.datadictionary.DataDictionaryStore" ) private GenericIdentifiableObjectStore dataDictionaryStore; + @Autowired + private DataElementService dataElementService; + + @Autowired + private IndicatorService indicatorService; + private DataElement dataElementA; private DataElement dataElementB; @@ -73,12 +82,6 @@ public void setUpTest() throws Exception { - dataDictionaryStore = (GenericIdentifiableObjectStore) getBean( "org.hisp.dhis.datadictionary.DataDictionaryStore" ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - dataDictionaryA = createDataDictionary( 'A' ); dataDictionaryB = createDataDictionary( 'B' ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboServiceTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboServiceTest.java 2014-10-07 13:46:29 +0000 @@ -40,6 +40,7 @@ import org.hisp.dhis.DhisSpringTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -48,6 +49,9 @@ public class DataElementCategoryComboServiceTest extends DhisSpringTest { + @Autowired + private DataElementCategoryService categoryService; + private DataElementCategoryOption categoryOptionA; private DataElementCategoryOption categoryOptionB; private DataElementCategoryOption categoryOptionC; @@ -72,9 +76,7 @@ @Override public void setUpTest() - { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - + { categories = new ArrayList<>(); categoryOptionA = new DataElementCategoryOption( "OptionA" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java 2014-10-07 13:46:29 +0000 @@ -37,20 +37,26 @@ import java.util.Collection; import java.util.List; +import javax.annotation.Resource; + import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland * @version $Id$ */ -@SuppressWarnings( "unchecked" ) public class DataElementCategoryComboStoreTest extends DhisSpringTest { + @Resource(name="org.hisp.dhis.dataelement.CategoryComboStore") private GenericIdentifiableObjectStore categoryComboStore; + @Autowired + private DataElementCategoryService categoryService; + private DataElementCategoryCombo categoryComboA; private DataElementCategoryCombo categoryComboB; private DataElementCategoryCombo categoryComboC; @@ -68,10 +74,6 @@ @Override public void setUpTest() { - categoryComboStore = (GenericIdentifiableObjectStore) getBean( "org.hisp.dhis.dataelement.CategoryComboStore" ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - categories = new ArrayList<>(); categoryA = new DataElementCategory( "CategoryA" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboServiceTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboServiceTest.java 2014-10-07 13:46:29 +0000 @@ -39,6 +39,7 @@ import org.hisp.dhis.DhisSpringTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -47,6 +48,9 @@ public class DataElementCategoryOptionComboServiceTest extends DhisSpringTest { + @Autowired + private DataElementCategoryService categoryService; + private DataElementCategory categoryA; private DataElementCategory categoryB; @@ -69,9 +73,7 @@ @Override public void setUpTest() throws Exception - { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - + { categoryOptionA = new DataElementCategoryOption( "Male" ); categoryOptionB = new DataElementCategoryOption( "Female" ); categoryOptionC = new DataElementCategoryOption( "0-20" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboStoreTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboStoreTest.java 2014-10-07 13:46:29 +0000 @@ -38,6 +38,7 @@ import org.hisp.dhis.DhisSpringTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -45,8 +46,12 @@ public class DataElementCategoryOptionComboStoreTest extends DhisSpringTest { + @Autowired private CategoryOptionComboStore categoryOptionComboStore; + @Autowired + private DataElementCategoryService categoryService; + private DataElementCategory categoryA; private DataElementCategory categoryB; @@ -69,11 +74,7 @@ @Override public void setUpTest() throws Exception - { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - categoryOptionComboStore = (CategoryOptionComboStore) getBean( "org.hisp.dhis.dataelement.CategoryOptionComboStore" ); - + { categoryOptionA = new DataElementCategoryOption( "Male" ); categoryOptionB = new DataElementCategoryOption( "Female" ); categoryOptionC = new DataElementCategoryOption( "0-20" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionServiceTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionServiceTest.java 2014-10-07 13:46:29 +0000 @@ -37,6 +37,7 @@ import org.hisp.dhis.DhisSpringTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -45,20 +46,13 @@ public class DataElementCategoryOptionServiceTest extends DhisSpringTest { + @Autowired + private DataElementCategoryService categoryService; + private DataElementCategoryOption categoryOptionA; private DataElementCategoryOption categoryOptionB; private DataElementCategoryOption categoryOptionC; - - // ------------------------------------------------------------------------- - // Fixture - // ------------------------------------------------------------------------- - - @Override - public void setUpTest() - { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - } - + // ------------------------------------------------------------------------- // Tests // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java 2014-10-07 13:46:29 +0000 @@ -35,6 +35,8 @@ import java.util.Collection; +import javax.annotation.Resource; + import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.junit.Test; @@ -42,26 +44,17 @@ * @author Lars Helge Overland * @version $Id$ */ -@SuppressWarnings( "unchecked" ) public class DataElementCategoryOptionStoreTest extends DhisSpringTest { + @Resource(name="org.hisp.dhis.dataelement.CategoryOptionStore") private GenericIdentifiableObjectStore categoryOptionStore; private DataElementCategoryOption categoryOptionA; private DataElementCategoryOption categoryOptionB; private DataElementCategoryOption categoryOptionC; - // ------------------------------------------------------------------------- - // Fixture - // ------------------------------------------------------------------------- - - @Override - public void setUpTest() - { - categoryOptionStore = (GenericIdentifiableObjectStore) getBean( "org.hisp.dhis.dataelement.CategoryOptionStore" ); - } - + // ------------------------------------------------------------------------- // Tests // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryStoreTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryStoreTest.java 2014-10-07 13:46:29 +0000 @@ -37,20 +37,26 @@ import java.util.Collection; import java.util.List; +import javax.annotation.Resource; + import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland * @version $Id$ */ -@SuppressWarnings( "unchecked" ) public class DataElementCategoryStoreTest extends DhisSpringTest { + @Resource(name="org.hisp.dhis.dataelement.CategoryStore") private GenericIdentifiableObjectStore categoryStore; - + + @Autowired + private DataElementCategoryService categoryService; + private DataElementCategoryOption categoryOptionA; private DataElementCategoryOption categoryOptionB; @@ -72,10 +78,6 @@ @Override public void setUpTest() { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - categoryStore = (GenericIdentifiableObjectStore) getBean( "org.hisp.dhis.dataelement.CategoryStore" ); - categoryOptionA = new DataElementCategoryOption( "CategoryOptionA" ); categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" ); categoryOptionC = new DataElementCategoryOption( "CategoryOptionC" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataentryform/DataEntryFormServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataentryform/DataEntryFormServiceTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataentryform/DataEntryFormServiceTest.java 2014-10-07 13:46:29 +0000 @@ -50,6 +50,7 @@ import org.hisp.dhis.period.MonthlyPeriodType; import org.hisp.dhis.period.PeriodType; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Bharath @@ -58,6 +59,18 @@ public class DataEntryFormServiceTest extends DhisSpringTest { + @Autowired + private DataSetService dataSetService; + + @Autowired + private DataEntryFormService dataEntryFormService; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataElementCategoryService categoryService; + private PeriodType periodType; private DataElement dataElement; @@ -78,14 +91,6 @@ public void setUpTest() throws Exception { - dataSetService = (DataSetService) getBean( DataSetService.ID ); - - dataEntryFormService = (DataEntryFormService) getBean( DataEntryFormService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - periodType = new MonthlyPeriodType(); dataElement = createDataElement( 'A' ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataentryform/DataEntryFormStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataentryform/DataEntryFormStoreTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataentryform/DataEntryFormStoreTest.java 2014-10-07 13:46:29 +0000 @@ -43,6 +43,7 @@ import org.hisp.dhis.period.PeriodStore; import org.hisp.dhis.period.PeriodType; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Bharath @@ -51,10 +52,13 @@ public class DataEntryFormStoreTest extends DhisSpringTest { + @Autowired private PeriodStore periodStore; + @Autowired private DataSetService dataSetService; + @Autowired private DataEntryFormStore dataEntryFormStore; private PeriodType periodType; @@ -63,12 +67,6 @@ public void setUpTest() throws Exception { - dataSetService = (DataSetService) getBean( DataSetService.ID ); - - periodStore = (PeriodStore) getBean( PeriodStore.ID ); - - dataEntryFormStore = (DataEntryFormStore) getBean( DataEntryFormStore.ID ); - periodType = periodStore.getAllPeriodTypes().iterator().next(); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java 2014-10-03 06:23:56 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/CompleteDataSetRegistrationServiceTest.java 2014-10-07 13:46:29 +0000 @@ -46,6 +46,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -53,6 +54,21 @@ public class CompleteDataSetRegistrationServiceTest extends DhisSpringTest { + @Autowired + private CompleteDataSetRegistrationService completeDataSetRegistrationService; + + @Autowired + private DataSetService dataSetService; + + @Autowired + private PeriodService periodService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private DataElementCategoryService categoryService; + private CompleteDataSetRegistration registrationA; private CompleteDataSetRegistration registrationB; private CompleteDataSetRegistration registrationC; @@ -84,16 +100,6 @@ @Override public void setUpTest() { - completeDataSetRegistrationService = (CompleteDataSetRegistrationService) getBean( CompleteDataSetRegistrationService.ID ); - - dataSetService = (DataSetService) getBean( DataSetService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - sourceA = createOrganisationUnit( 'A' ); sourceB = createOrganisationUnit( 'B' ); sourceC = createOrganisationUnit( 'C' ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueAuditServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueAuditServiceTest.java 2014-10-03 06:28:50 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueAuditServiceTest.java 2014-10-07 13:46:29 +0000 @@ -47,6 +47,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * Created by Halvdan Hoem Grelland @@ -54,6 +55,24 @@ public class DataValueAuditServiceTest extends DhisSpringTest { + @Autowired + private DataValueAuditService dataValueAuditService; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private PeriodService periodService; + + @Autowired + private OrganisationUnitService organisationUnitService ; + // ------------------------------------------------------------------------- // Supporting data // ------------------------------------------------------------------------- @@ -100,18 +119,6 @@ public void setUpTest() throws Exception { - dataValueAuditService = (DataValueAuditService) getBean( DataValueAuditService.ID ); - - dataValueService = (DataValueService) getBean( DataValueService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - // --------------------------------------------------------------------- // Add supporting data // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java 2014-10-03 06:28:50 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java 2014-10-07 13:46:29 +0000 @@ -50,6 +50,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -57,6 +58,21 @@ public class DataValueDimensionTest extends DhisSpringTest { + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private PeriodService periodService; + + @Autowired + private OrganisationUnitService organisationUnitService; + private DataElementCategoryOption male; private DataElementCategoryOption female; private DataElementCategoryOption under15; @@ -78,13 +94,6 @@ @Override public void setUpTest() { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - dataElementService = (DataElementService) getBean( DataElementService.ID ); - dataValueService = (DataValueService) getBean( DataValueService.ID ); - periodService = (PeriodService) getBean( PeriodService.ID ); - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - male = new DataElementCategoryOption( "Male" ); female = new DataElementCategoryOption( "Female" ); under15 = new DataElementCategoryOption( "<15" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java 2014-10-07 13:46:29 +0000 @@ -46,6 +46,7 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Kristian Nordal @@ -54,6 +55,21 @@ public class DataValueServiceTest extends DhisTest { + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private PeriodService periodService; + + @Autowired + private OrganisationUnitService organisationUnitService; + // ------------------------------------------------------------------------- // Supporting data // ------------------------------------------------------------------------- @@ -91,17 +107,7 @@ @Override public void setUpTest() throws Exception - { - dataValueService = (DataValueService) getBean( DataValueService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - + { // --------------------------------------------------------------------- // Add supporting data // --------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java 2014-08-28 12:01:44 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java 2014-10-07 13:46:29 +0000 @@ -61,6 +61,7 @@ import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.hisp.dhis.period.Period; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -68,6 +69,27 @@ public class ExpressionServiceTest extends DhisSpringTest { + @Autowired + private ExpressionService expressionService; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private ConstantService constantService; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private OrganisationUnitGroupService organisationUnitGroupService; + private DataElementCategoryOption categoryOptionA; private DataElementCategoryOption categoryOptionB; private DataElementCategoryOption categoryOptionC; @@ -120,20 +142,6 @@ public void setUpTest() throws Exception { - expressionService = (ExpressionService) getBean( ExpressionService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - constantService = (ConstantService) getBean( ConstantService.ID ); - - dataValueService = (DataValueService) getBean( DataValueService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - - organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID ); - categoryOptionA = new DataElementCategoryOption( "Under 5" ); categoryOptionB = new DataElementCategoryOption( "Over 5" ); categoryOptionC = new DataElementCategoryOption( "Male" ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionStoreTest.java 2014-08-26 10:51:19 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionStoreTest.java 2014-10-07 13:46:29 +0000 @@ -37,6 +37,8 @@ import java.util.HashSet; import java.util.Set; +import javax.annotation.Resource; + import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.common.GenericStore; import org.hisp.dhis.dataelement.DataElement; @@ -45,17 +47,24 @@ import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland * @version $Id$ */ -@SuppressWarnings( "unchecked" ) public class ExpressionStoreTest extends DhisSpringTest { + @Resource( name = "org.hisp.dhis.expression.ExpressionStore" ) private GenericStore expressionStore; + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataElementCategoryService categoryService; + private int dataElementIdA; private int dataElementIdB; @@ -84,10 +93,6 @@ public void setUpTest() throws Exception { - expressionStore = (GenericStore) getBean( "org.hisp.dhis.expression.ExpressionStore" ); - dataElementService = (DataElementService) getBean( DataElementService.ID ); - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - DataElement dataElementA = createDataElement( 'A' ); DataElement dataElementB = createDataElement( 'B' ); DataElement dataElementC = createDataElement( 'C' ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/help/HelpManagerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/help/HelpManagerTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/help/HelpManagerTest.java 2014-10-07 13:46:29 +0000 @@ -32,6 +32,7 @@ import org.apache.commons.logging.LogFactory; import org.hisp.dhis.DhisSpringTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; import java.io.ByteArrayOutputStream; import java.util.Locale; @@ -44,14 +45,9 @@ { private static final Log log = LogFactory.getLog( HelpManagerTest.class ); + @Autowired private HelpManager helpManager; - @Override - public void setUpTest() - { - helpManager = (HelpManager) getBean( HelpManager.ID ); - } - @Test public void testGetEmbeddedHelpContent() { === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java 2014-10-03 06:28:50 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/i18n/I18nServiceTest.java 2014-10-07 13:46:29 +0000 @@ -44,6 +44,7 @@ import org.hisp.dhis.dataelement.DataElementService; import org.junit.Before; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -51,21 +52,12 @@ public class I18nServiceTest extends DhisSpringTest { + @Autowired private I18nService i18nService; - - // ------------------------------------------------------------------------- - // Set up/tear down - // ------------------------------------------------------------------------- - - @Before - public void setUpTest() - throws Exception - { - i18nService = (I18nService) getBean( I18nService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - } + @Autowired + private DataElementService dataElementService; + // ------------------------------------------------------------------------- // Tests // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorGroupStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorGroupStoreTest.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorGroupStoreTest.java 2014-10-07 13:46:29 +0000 @@ -35,6 +35,8 @@ import java.util.Collection; +import javax.annotation.Resource; + import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.common.GenericIdentifiableObjectStore; import org.junit.Test; @@ -43,18 +45,12 @@ * @author Lars Helge Overland * @version $Id$ */ -@SuppressWarnings("unchecked") public class IndicatorGroupStoreTest extends DhisSpringTest { + @Resource(name="org.hisp.dhis.indicator.IndicatorGroupStore") private GenericIdentifiableObjectStore indicatorGroupStore; - @Override - public void setUpTest() - { - indicatorGroupStore = (GenericIdentifiableObjectStore) getBean( "org.hisp.dhis.indicator.IndicatorGroupStore" ); - } - @Test public void testAddIndicatorGroup() throws Exception === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorStoreTest.java 2014-10-02 10:21:06 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/indicator/IndicatorStoreTest.java 2014-10-07 13:46:29 +0000 @@ -35,33 +35,24 @@ import java.util.Collection; +import javax.annotation.Resource; + import static org.junit.Assert.*; /** * @author Lars Helge Overland * @version $Id: IndicatorStoreTest.java 3286 2007-05-07 18:05:21Z larshelg $ */ -@SuppressWarnings( "unchecked" ) public class IndicatorStoreTest extends DhisSpringTest { @Autowired private IndicatorStore indicatorStore; + @Resource(name="org.hisp.dhis.indicator.IndicatorTypeStore") private GenericIdentifiableObjectStore indicatorTypeStore; // ------------------------------------------------------------------------- - // Set up/tear down - // ------------------------------------------------------------------------- - - @Override - public void setUpTest() - throws Exception - { - indicatorTypeStore = (GenericIdentifiableObjectStore) getBean( "org.hisp.dhis.indicator.IndicatorTypeStore" ); - } - - // ------------------------------------------------------------------------- // Support methods // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -60,6 +60,21 @@ @Autowired private BatchHandlerFactory batchHandlerFactory; + @Autowired + private DataSetService dataSetService; + + @Autowired + private PeriodService periodService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private CompleteDataSetRegistrationService completeDataSetRegistrationService; + + @Autowired + private DataElementCategoryService categoryService; + private BatchHandler batchHandler; private DataSet dataSetA; @@ -93,13 +108,6 @@ @Override public void setUpTest() { - dataSetService = (DataSetService) getBean( DataSetService.ID ); - periodService = (PeriodService) getBean( PeriodService.ID ); - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - completeDataSetRegistrationService = (CompleteDataSetRegistrationService) getBean( - CompleteDataSetRegistrationService.ID ); - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( CompleteDataSetRegistrationBatchHandler.class ); dataSetA = createDataSet( 'A', new MonthlyPeriodType() ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataDictionaryBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataDictionaryBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataDictionaryBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -52,6 +52,9 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; + + @Autowired + private DataDictionaryService dataDictionaryService ; private BatchHandler batchHandler; @@ -66,7 +69,6 @@ @Override public void setUpTest() { - dataDictionaryService = (DataDictionaryService) getBean( DataDictionaryService.ID ); batchHandler = batchHandlerFactory.createBatchHandler( DataDictionaryBatchHandler.class ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -58,7 +58,13 @@ @Autowired private HibernateCacheManager cacheManager; - + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private DataElementService dataElementService; + private BatchHandler batchHandler; private DataElementCategoryCombo categoryCombo; @@ -74,11 +80,7 @@ @Override public void setUpTest() { - dataElementService = (DataElementService) getBean( DataElementService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( DataElementBatchHandler.class ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); categoryCombo = categoryService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -54,6 +54,9 @@ @Autowired private BatchHandlerFactory batchHandlerFactory; + @Autowired + private DataElementCategoryService categoryService; + private BatchHandler batchHandler; private DataElementCategory categoryA; @@ -67,8 +70,6 @@ @Override public void setUpTest() { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( DataElementCategoryBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryComboBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryComboBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryComboBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -52,6 +52,9 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; + + @Autowired + private DataElementCategoryService categoryService; private BatchHandler batchHandler; @@ -65,9 +68,7 @@ @Override public void setUpTest() - { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - + { batchHandler = batchHandlerFactory.createBatchHandler( DataElementCategoryComboBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -52,6 +52,9 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; + + @Autowired + private DataElementCategoryService categoryService; private BatchHandler batchHandler; @@ -65,11 +68,7 @@ @Override public void setUpTest() - { - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - + { batchHandler = batchHandlerFactory.createBatchHandler( DataElementCategoryOptionBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -53,6 +53,7 @@ @Autowired private BatchHandlerFactory batchHandlerFactory; + @Autowired private DataElementService dataElementService; private BatchHandler batchHandler; @@ -68,8 +69,6 @@ @Override public void setUpTest() { - dataElementService = (DataElementService) getBean( DataElementService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( DataElementGroupBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupSetBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupSetBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupSetBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -53,6 +53,7 @@ @Autowired private BatchHandlerFactory batchHandlerFactory; + @Autowired private DataElementService dataElementService; private BatchHandler batchHandler; @@ -68,8 +69,6 @@ @Override public void setUpTest() { - dataElementService = (DataElementService) getBean( DataElementService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( DataElementGroupSetBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -52,7 +52,13 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; - + + @Autowired + private DataSetService dataSetService; + + @Autowired + private PeriodService periodService; + private BatchHandler batchHandler; private DataSet dataSetA; @@ -66,10 +72,6 @@ @Override public void setUpTest() { - dataSetService = (DataSetService) getBean( DataSetService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( DataSetBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -62,6 +62,21 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; + + @Autowired + private DataValueService dataValueService; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private PeriodService periodService; + + @Autowired + private OrganisationUnitService organisationUnitService; private BatchHandler batchHandler; @@ -89,16 +104,6 @@ @Override public void setUpTest() { - dataValueService = (DataValueService) getBean( DataValueService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( DataValueBatchHandler.class ); dataElementA = createDataElement( 'A' ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/GroupSetBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/GroupSetBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/GroupSetBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -53,6 +53,9 @@ @Autowired private BatchHandlerFactory batchHandlerFactory; + @Autowired + private OrganisationUnitGroupService organisationUnitGroupService; + private BatchHandler batchHandler; private OrganisationUnitGroupSet groupSetA; @@ -65,9 +68,7 @@ @Override public void setUpTest() - { - organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID ); - + { batchHandler = batchHandlerFactory.createBatchHandler( GroupSetBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -57,7 +57,10 @@ @Autowired private HibernateCacheManager cacheManager; - + + @Autowired + private IndicatorService indicatorService; + private BatchHandler batchHandler; private Indicator indicatorA; @@ -70,9 +73,7 @@ @Override public void setUpTest() - { - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - + { batchHandler = batchHandlerFactory.createBatchHandler( IndicatorBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorGroupBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorGroupBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorGroupBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -52,6 +52,9 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; + + @Autowired + private IndicatorService indicatorService; private BatchHandler batchHandler; @@ -66,8 +69,6 @@ @Override public void setUpTest() { - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( IndicatorGroupBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorGroupSetBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorGroupSetBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorGroupSetBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -52,6 +52,9 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; + + @Autowired + private IndicatorService indicatorService; private BatchHandler batchHandler; @@ -65,9 +68,7 @@ @Override public void setUpTest() - { - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - + { batchHandler = batchHandlerFactory.createBatchHandler( IndicatorGroupSetBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorTypeBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorTypeBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorTypeBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -52,9 +52,10 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; - + + @Autowired private IndicatorService indicatorService; - + private BatchHandler batchHandler; private IndicatorType indicatorTypeA; @@ -67,9 +68,7 @@ @Override public void setUpTest() - { - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - + { batchHandler = batchHandlerFactory.createBatchHandler( IndicatorTypeBatchHandler.class ); indicatorTypeA = createIndicatorType( 'A' ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitGroupBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitGroupBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitGroupBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -52,6 +52,8 @@ { @Autowired private BatchHandlerFactory batchHandlerFactory; + @Autowired + private OrganisationUnitGroupService organisationUnitGroupService; private BatchHandler batchHandler; @@ -66,8 +68,6 @@ @Override public void setUpTest() { - organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID ); - batchHandler = batchHandlerFactory.createBatchHandler( OrganisationUnitGroupBatchHandler.class ); batchHandler.init(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/PeriodBatchHandlerTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/PeriodBatchHandlerTest.java 2014-08-24 13:57:12 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/PeriodBatchHandlerTest.java 2014-10-07 13:46:29 +0000 @@ -57,6 +57,9 @@ @Autowired private BatchHandlerFactory batchHandlerFactory; + @Autowired + private PeriodService periodService; + private BatchHandler batchHandler; private PeriodType periodType; @@ -76,9 +79,7 @@ @Override public void setUpTest() - { - periodService = (PeriodService) getBean( PeriodService.ID ); - + { periodType = periodService.getPeriodTypeByName( MonthlyPeriodType.NAME ); Calendar calendar = Calendar.getInstance(); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java 2014-10-07 13:46:29 +0000 @@ -53,6 +53,7 @@ import org.hisp.dhis.period.PeriodService; import org.hisp.dhis.period.PeriodType; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -61,12 +62,21 @@ public class MappingServiceTest extends DhisSpringTest { + @Autowired private MappingService mappingService; - private OrganisationUnit organisationUnit; - - private OrganisationUnitLevel organisationUnitLevel; - + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private IndicatorService indicatorService; + + @Autowired + private DataElementService dataElementService; + + @Autowired + private PeriodService periodService; + private IndicatorGroup indicatorGroup; private IndicatorType indicatorType; @@ -90,18 +100,8 @@ @Override public void setUpTest() { - mappingService = (MappingService) getBean( MappingService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - - indicatorService = (IndicatorService) getBean( IndicatorService.ID ); - - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - periodService = (PeriodService) getBean( PeriodService.ID ); - - organisationUnit = createOrganisationUnit( 'A' ); - organisationUnitLevel = new OrganisationUnitLevel( 1, "Level" ); + OrganisationUnit organisationUnit = createOrganisationUnit( 'A' ); + OrganisationUnitLevel organisationUnitLevel = new OrganisationUnitLevel( 1, "Level" ); organisationUnitService.addOrganisationUnit( organisationUnit ); organisationUnitService.addOrganisationUnitLevel( organisationUnitLevel ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java 2014-09-22 14:26:53 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/message/MessageServiceTest.java 2014-10-07 13:46:29 +0000 @@ -42,6 +42,7 @@ import org.hisp.dhis.user.UserService; import org.junit.Before; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -49,6 +50,12 @@ public class MessageServiceTest extends DhisSpringTest { + @Autowired + private MessageService messageService; + + @Autowired + private UserService _userService; + private User sender; private User userA; private User userB; @@ -63,8 +70,7 @@ @Before public void setUpTest() { - messageService = (MessageService) getBean( MessageService.ID ); - userService = (UserService) getBean( UserService.ID ); + userService = _userService; sender = createUser( 'S' ); userA = createUser( 'A' ); === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java 2014-08-15 07:40:20 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java 2014-10-07 13:46:29 +0000 @@ -44,6 +44,7 @@ import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitService; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Kristian Nordal @@ -52,21 +53,18 @@ public class MinMaxDataElementStoreTest extends DhisSpringTest { - private MinMaxDataElementStore minMaxDataElementStore; - - @Override - public void setUpTest() - throws Exception - { - dataElementService = (DataElementService) getBean( DataElementService.ID ); - - organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID ); - - categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID ); - - minMaxDataElementStore = (MinMaxDataElementStore) getBean( MinMaxDataElementStore.ID ); - } - + @Autowired + private DataElementService dataElementService; + + @Autowired + private OrganisationUnitService organisationUnitService; + + @Autowired + private DataElementCategoryService categoryService; + + @Autowired + private MinMaxDataElementStore minMaxDataElementStore; + @Test public void testBasic() throws Exception === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/option/OptionServiceTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/option/OptionServiceTest.java 2014-10-03 06:28:50 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/option/OptionServiceTest.java 2014-10-07 13:46:29 +0000 @@ -36,6 +36,7 @@ import org.hisp.dhis.DhisSpringTest; import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; /** * @author Lars Helge Overland @@ -43,6 +44,7 @@ public class OptionServiceTest extends DhisSpringTest { + @Autowired private OptionService optionService; private List