dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33292
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16982: Use @Autowired for services in test classes instead of using getBean() method.
------------------------------------------------------------
revno: 16982
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-10-07 20:46:29 +0700
message:
Use @Autowired for services in test classes instead of using getBean() method.
modified:
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/DataBrowserStoreTest.java
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/dataintegrity/DataIntegrityServiceTest.java
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/resourcetable/ResourceTableServiceTest.java
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/statistics/StatisticsProviderTest.java
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/AttributeStoreTest.java
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/AttributeValueStoreTest.java
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/common/IdentifiableObjectManagerTest.java
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/constant/ConstantServiceTest.java
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/MinMaxOutlierAnalysisServiceTest.java
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/dataapproval/DataApprovalServiceTest.java
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/DataDictionaryStoreTest.java
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/DataElementCategoryComboStoreTest.java
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/DataElementCategoryOptionComboStoreTest.java
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/DataElementCategoryOptionStoreTest.java
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/dataentryform/DataEntryFormServiceTest.java
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/dataset/CompleteDataSetRegistrationServiceTest.java
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/DataValueDimensionTest.java
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/expression/ExpressionServiceTest.java
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/help/HelpManagerTest.java
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/indicator/IndicatorGroupStoreTest.java
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/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java
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/DataElementBatchHandlerTest.java
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/DataElementCategoryComboBatchHandlerTest.java
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/DataElementGroupBatchHandlerTest.java
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/DataSetBatchHandlerTest.java
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/GroupSetBatchHandlerTest.java
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/IndicatorGroupBatchHandlerTest.java
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/IndicatorTypeBatchHandlerTest.java
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/PeriodBatchHandlerTest.java
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/message/MessageServiceTest.java
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/option/OptionServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingManagerTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserAuthorityGroupTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserGroupServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationCriteriaServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationCriteriaStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/version/VersionServiceTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceAggregationLevelsTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceMultiDimensionTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceOrgUnitTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTimeDimensionTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabStoreTest.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java
dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/analysis/ImportAnalyserTest.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dhis14/Dhis14XmlImportServiceTest.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFOrganisationUnitsTest.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/GML2DXFTest.java
dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/mapping/ObjectMappingGeneratorTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentServiceTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapLayerTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/MapGeneratorServiceTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/orgunitdistribution/OrgUnitDistributionServiceTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java
dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-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<Objects, Integer> counts = statisticsProvider.getObjectCounts();
-
+
assertNotNull( counts );
assertEquals( new Integer( 3 ), counts.get( Objects.DATAELEMENT ) );
}
@@ -83,7 +84,7 @@
public void testGetDataElementGroupObjectCounts()
{
Map<Objects, Integer> 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<AttributeValue> 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<AttributeValue>) 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<DataElement> 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<DeflatedDataValue> values = stdDevOutlierAnalysisService.analyse( ListUtils.getCollection( organisationUnitA ), dataElementsA, periods, stdDevFactor );
+ Collection<DeflatedDataValue> 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<DataDictionary> 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<DataDictionary>) 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<DataElementCategoryCombo> categoryComboStore;
+ @Autowired
+ private DataElementCategoryService categoryService;
+
private DataElementCategoryCombo categoryComboA;
private DataElementCategoryCombo categoryComboB;
private DataElementCategoryCombo categoryComboC;
@@ -68,10 +74,6 @@
@Override
public void setUpTest()
{
- categoryComboStore = (GenericIdentifiableObjectStore<DataElementCategoryCombo>) 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<DataElementCategoryOption> categoryOptionStore;
private DataElementCategoryOption categoryOptionA;
private DataElementCategoryOption categoryOptionB;
private DataElementCategoryOption categoryOptionC;
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- {
- categoryOptionStore = (GenericIdentifiableObjectStore<DataElementCategoryOption>) 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<DataElementCategory> 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<DataElementCategory>) 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<Expression> 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<Expression>) 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<IndicatorGroup> indicatorGroupStore;
- @Override
- public void setUpTest()
- {
- indicatorGroupStore = (GenericIdentifiableObjectStore<IndicatorGroup>) 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<IndicatorType> indicatorTypeStore;
// -------------------------------------------------------------------------
- // Set up/tear down
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- throws Exception
- {
- indicatorTypeStore = (GenericIdentifiableObjectStore<IndicatorType>) 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<CompleteDataSetRegistration> 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<DataDictionary> 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<DataElement> 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<DataElementCategory> 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<DataElementCategoryCombo> 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<DataElementCategoryOption> 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<DataElementGroup> 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<DataElementGroupSet> 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<DataSet> 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<DataValue> 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<OrganisationUnitGroupSet> 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<Indicator> 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<IndicatorGroup> 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<IndicatorGroupSet> 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<IndicatorType> 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<OrganisationUnitGroup> 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<Period> 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<Option> options = new ArrayList<>();
@@ -61,8 +63,6 @@
@Override
public void setUpTest()
{
- optionService = (OptionService) getBean( OptionService.ID );
-
option1 = new Option("OptA1","OptA1");
option2 = new Option("OptA2","OptA2");
option3 = new Option("OptB1","OptB1");
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2014-10-02 09:53:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2014-10-07 13:46:29 +0000
@@ -45,6 +45,7 @@
import org.hisp.dhis.DhisSpringTest;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Kristian Nordal
@@ -52,19 +53,12 @@
public class OrganisationUnitServiceTest
extends DhisSpringTest
{
+ @Autowired
private OrganisationUnitService organisationUnitService;
+ @Autowired
private OrganisationUnitGroupService organisationUnitGroupService;
- @Override
- public void setUpTest()
- throws Exception
- {
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID );
- }
-
// -------------------------------------------------------------------------
// OrganisationUnit
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitStoreTest.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,14 +46,9 @@
public class OrganisationUnitStoreTest
extends DhisSpringTest
{
+ @Autowired
private OrganisationUnitLevelStore organisationUnitLevelStore;
- @Override
- public void setUpTest()
- {
- organisationUnitLevelStore = (OrganisationUnitLevelStore) getBean( OrganisationUnitLevelStore.ID );
- }
-
// -------------------------------------------------------------------------
// OrganisationUnitLevel
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java 2014-10-07 13:46:29 +0000
@@ -41,6 +41,7 @@
import org.hisp.dhis.DhisSpringTest;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Kristian Nordal
@@ -49,17 +50,8 @@
public class PeriodServiceTest
extends DhisSpringTest
{
+ @Autowired
private PeriodService periodService;
-
- // -------------------------------------------------------------------------
- // Set up/tear down
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- {
- periodService = (PeriodService) getBean( PeriodService.ID );
- }
// -------------------------------------------------------------------------
// Period
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.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 Torgeir Lorange Ostby
@@ -48,20 +49,10 @@
public class PeriodStoreTest
extends DhisSpringTest
{
+ @Autowired
private PeriodStore periodStore;
// -------------------------------------------------------------------------
- // Set up/tear down
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- throws Exception
- {
- periodStore = (PeriodStore) getBean( PeriodStore.ID );
- }
-
- // -------------------------------------------------------------------------
// Period
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingManagerTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingManagerTest.java 2014-05-15 16:58:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingManagerTest.java 2014-10-07 13:46:29 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.setting.SystemSetting;
import org.hisp.dhis.setting.SystemSettingManager;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Stian Strandli
@@ -49,15 +50,9 @@
public class SystemSettingManagerTest
extends DhisSpringTest
{
+ @Autowired
private SystemSettingManager systemSettingManager;
- @Override
- public void setUpTest()
- throws Exception
- {
- systemSettingManager = (SystemSettingManager) getBean( SystemSettingManager.ID );
- }
-
@Test
public void testSaveGetSystemSetting()
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingStoreTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/setting/SystemSettingStoreTest.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 Stian Strandli
@@ -43,6 +44,7 @@
public class SystemSettingStoreTest
extends DhisSpringTest
{
+ @Autowired
private SystemSettingStore systemSettingStore;
private SystemSetting settingA;
@@ -53,8 +55,6 @@
public void setUpTest()
throws Exception
{
- systemSettingStore = (SystemSettingStore) getBean( "org.hisp.dhis.setting.SystemSettingStore" );
-
settingA = new SystemSetting();
settingA.setName( "Setting1" );
settingA.setValue( new String( "Value1" ) );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationServiceTest.java 2014-09-30 13:48:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationServiceTest.java 2014-10-07 13:46:29 +0000
@@ -31,6 +31,7 @@
import org.hisp.dhis.DhisSpringTest;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import java.util.Locale;
@@ -42,6 +43,7 @@
public class TranslationServiceTest
extends DhisSpringTest
{
+ @Autowired
private TranslationService translationService;
// -------------------------------------------------------------------------
@@ -71,8 +73,6 @@
@Override
public void setUpTest()
{
- translationService = (TranslationService) getBean( TranslationService.ID );
-
translation1a = new Translation( className1, locale1, "name", "cheers", uid1 );
translation1b = new Translation( className1, locale1, "shortName", "goodbye", uid1 );
translation2a = new Translation( className1, locale2, "name", "hello", uid1 );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java 2014-05-14 05:24:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/translation/TranslationStoreTest.java 2014-10-07 13:46:29 +0000
@@ -40,6 +40,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Oyvind Brucker
@@ -48,19 +49,10 @@
public class TranslationStoreTest
extends DhisSpringTest
{
+ @Autowired
private TranslationStore translationStore;
// -------------------------------------------------------------------------
- // Set up/tear down
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- {
- translationStore = (TranslationStore) getBean( TranslationStore.ID );
- }
-
- // -------------------------------------------------------------------------
// Testdata
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserAuthorityGroupTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserAuthorityGroupTest.java 2014-10-01 09:03:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserAuthorityGroupTest.java 2014-10-07 13:46:29 +0000
@@ -32,6 +32,8 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.junit.Test;
@@ -39,15 +41,9 @@
public class UserAuthorityGroupTest
extends DhisSpringTest
{
+ @Resource(name="org.hisp.dhis.user.UserAuthorityGroupStore")
private GenericIdentifiableObjectStore<UserAuthorityGroup> userAuthorityGroupStore;
- @Override
- @SuppressWarnings("unchecked")
- public void setUpTest() throws Exception
- {
- userAuthorityGroupStore = (GenericIdentifiableObjectStore<UserAuthorityGroup>) getBean( "org.hisp.dhis.user.UserAuthorityGroupStore" );
- }
-
@Test
public void testAddGetUserAuthorityGroup()
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserGroupServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserGroupServiceTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserGroupServiceTest.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;
import java.util.ArrayList;
import java.util.HashSet;
@@ -45,8 +46,12 @@
public class UserGroupServiceTest
extends DhisSpringTest
{
+ @Autowired
private UserGroupService userGroupService;
+ @Autowired
+ private UserService userService;
+
private User user1;
private User user2;
private User user3;
@@ -55,9 +60,6 @@
public void setUpTest()
throws Exception
{
- userService = (UserService) getBean( UserService.ID );
- userGroupService = (UserGroupService) getBean( UserGroupService.ID );
-
user1 = createUser( 'A' );
user2 = createUser( 'B' );
user3 = createUser( 'C' );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserStoreTest.java 2014-10-01 13:56:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/user/UserStoreTest.java 2014-10-07 13:46:29 +0000
@@ -39,6 +39,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 Nguyen Hong Duc
@@ -47,25 +48,22 @@
public class UserStoreTest
extends DhisSpringTest
{
+ @Autowired
private UserStore userStore;
-
+
+ @Autowired
private UserCredentialsStore userCredentialsStore;
+ @Autowired
private OrganisationUnitService organisationUnitService;
-
+
private OrganisationUnit unit1;
private OrganisationUnit unit2;
@Override
public void setUpTest()
throws Exception
- {
- userStore = (UserStore) getBean( UserStore.ID );
-
- userCredentialsStore = (UserCredentialsStore) getBean( UserCredentialsStore.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
+ {
unit1 = createOrganisationUnit( 'A' );
unit2 = createOrganisationUnit( 'B' );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationCriteriaServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationCriteriaServiceTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationCriteriaServiceTest.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 Chau Thu Tran
@@ -45,6 +46,7 @@
public class ValidationCriteriaServiceTest
extends DhisSpringTest
{
+ @Autowired
private ValidationCriteriaService validationCriteriaService;
private String propertyA;
@@ -67,8 +69,6 @@
public void setUpTest()
throws Exception
{
- validationCriteriaService = (ValidationCriteriaService) getBean( ValidationCriteriaService.ID );
-
propertyA = "name";
propertyB = "name";
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationCriteriaStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationCriteriaStoreTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationCriteriaStoreTest.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,10 +45,10 @@
* @author Chau Thu Tran
* @version ValidationCriteriaStoreTest.java May 25, 201011:38:25 AM
*/
-@SuppressWarnings( "unchecked" )
public class ValidationCriteriaStoreTest
extends DhisSpringTest
{
+ @Resource(name="org.hisp.dhis.validation.ValidationCriteriaStore")
private GenericIdentifiableObjectStore<ValidationCriteria> validationCriteriaStore;
private String propertyA;
@@ -65,8 +67,6 @@
public void setUpTest()
throws Exception
{
- validationCriteriaStore = (GenericIdentifiableObjectStore<ValidationCriteria>) getBean( "org.hisp.dhis.validation.ValidationCriteriaStore" );
-
propertyA = "name";
propertyB = "name";
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java 2014-08-26 10:51:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java 2014-10-07 13:46:29 +0000
@@ -38,6 +38,8 @@
import java.util.HashSet;
import java.util.Set;
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.dataelement.DataElement;
@@ -48,19 +50,28 @@
import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.period.PeriodType;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
*/
-@SuppressWarnings( "unchecked" )
public class ValidationRuleGroupStoreTest
extends DhisSpringTest
{
+ @Resource(name="org.hisp.dhis.validation.ValidationRuleStore")
private GenericIdentifiableObjectStore<ValidationRule> validationRuleStore;
+ @Resource(name="org.hisp.dhis.validation.ValidationRuleGroupStore")
private GenericIdentifiableObjectStore<ValidationRuleGroup> validationRuleGroupStore;
+ @Autowired
private ExpressionService expressionService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
private DataElement dataElementA;
@@ -88,16 +99,6 @@
public void setUpTest()
throws Exception
{
- validationRuleStore = (GenericIdentifiableObjectStore<ValidationRule>) getBean( "org.hisp.dhis.validation.ValidationRuleStore" );
-
- validationRuleGroupStore = (GenericIdentifiableObjectStore<ValidationRuleGroup>) getBean( "org.hisp.dhis.validation.ValidationRuleGroupStore" );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- expressionService = (ExpressionService) getBean( ExpressionService.ID );
-
dataElementA = createDataElement( 'A' );
dataElementB = createDataElement( 'B' );
dataElementC = createDataElement( 'C' );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java 2014-10-03 06:28:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java 2014-10-07 13:46:29 +0000
@@ -71,6 +71,7 @@
import org.hisp.dhis.system.util.MathUtils;
import org.hisp.dhis.user.CurrentUserService;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -79,6 +80,30 @@
public class ValidationRuleServiceTest
extends DhisTest
{
+ @Autowired
+ private ValidationRuleService validationRuleService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private ExpressionService expressionService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private PeriodService periodService;
+
private DataElement dataElementA;
private DataElement dataElementB;
@@ -227,24 +252,6 @@
public void setUpTest()
throws Exception
{
- validationRuleService = (ValidationRuleService) getBean( ValidationRuleService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- expressionService = (ExpressionService) getBean( ExpressionService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
CurrentUserService currentUserService = new MockCurrentUserService( allSources, null );
setDependency( validationRuleService, "currentUserService", currentUserService, CurrentUserService.class );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java 2014-08-26 10:51:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java 2014-10-07 13:46:29 +0000
@@ -48,6 +48,7 @@
import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.period.PeriodType;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -55,8 +56,16 @@
public class ValidationRuleStoreTest
extends DhisSpringTest
{
+ @Autowired
private ValidationRuleStore validationRuleStore;
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
private ExpressionService expressionService;
private DataElement dataElementA;
@@ -85,14 +94,7 @@
public void setUpTest()
throws Exception
{
- validationRuleStore = (ValidationRuleStore) getBean( ValidationRuleStore.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- expressionService = (ExpressionService) getBean( ExpressionService.ID );
-
+
dataElementA = createDataElement( 'A' );
dataElementB = createDataElement( 'B' );
dataElementC = createDataElement( 'C' );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/version/VersionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/version/VersionServiceTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/version/VersionServiceTest.java 2014-10-07 13:46:29 +0000
@@ -29,7 +29,10 @@
*/
import java.util.Collection;
+
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
import static org.junit.Assert.*;
import org.hisp.dhis.DhisSpringTest;
@@ -37,6 +40,7 @@
public class VersionServiceTest
extends DhisSpringTest
{
+ @Autowired
private VersionService versionService;
private Version versionA;
@@ -46,8 +50,6 @@
@Override
protected void setUpTest()
{
- versionService = (VersionService) getBean( "org.hisp.dhis.version.VersionService" );
-
versionA = new Version();
versionA.setKey( "keyA" );
versionA.setValue( "valueA" );
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceAggregationLevelsTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceAggregationLevelsTest.java 2014-09-23 07:43:22 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceAggregationLevelsTest.java 2014-10-07 13:46:29 +0000
@@ -51,6 +51,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
@@ -59,14 +60,30 @@
public class DataMartServiceAggregationLevelsTest
extends DhisTest
{
+ @Autowired
private DataMartEngine dataMartEngine;
-
+
+ @Autowired
private AggregatedDataValueService aggregatedDataValueService;
- private DataElementCategoryCombo categoryCombo;
-
- private DataElementCategoryOptionCombo categoryOptionCombo;
-
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
private Collection<Integer> dataElementIds;
private Collection<Integer> periodIds;
private Collection<Integer> organisationUnitIds;
@@ -88,6 +105,10 @@
private OrganisationUnit unitK;
private OrganisationUnit unitL;
private OrganisationUnit unitM;
+
+ private DataElementCategoryCombo categoryCombo;
+
+ private DataElementCategoryOptionCombo categoryOptionCombo;
// -------------------------------------------------------------------------
// Fixture
@@ -96,26 +117,10 @@
@Override
public void setUpTest()
{
- dataMartEngine = (DataMartEngine) getBean( DataMartEngine.ID );
-
- aggregatedDataValueService = (AggregatedDataValueService) getBean( AggregatedDataValueService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
categoryCombo = categoryService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
-
+
// ---------------------------------------------------------------------
// Setup identifier Collections
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceMultiDimensionTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceMultiDimensionTest.java 2014-09-23 07:43:22 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceMultiDimensionTest.java 2014-10-07 13:46:29 +0000
@@ -60,6 +60,7 @@
import org.hisp.dhis.period.QuarterlyPeriodType;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -68,13 +69,36 @@
public class DataMartServiceMultiDimensionTest
extends DhisTest
{
+ @Autowired
+ private DataMartEngine dataMartEngine;
+
+ @Autowired
+ private AggregatedDataValueService aggregatedDataValueService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
+ @Autowired
+ private IndicatorService indicatorService;
+
private final String T = "true";
private final String F = "false";
- private DataMartEngine dataMartEngine;
-
- private AggregatedDataValueService aggregatedDataValueService;
-
private DataElementCategoryOption categoryOptionA;
private DataElementCategoryOption categoryOptionB;
@@ -104,31 +128,7 @@
@Override
public void setUpTest()
- {
- // ---------------------------------------------------------------------
- // Dependencies
- // ---------------------------------------------------------------------
-
- dataMartEngine = (DataMartEngine) getBean( DataMartEngine.ID );
-
- aggregatedDataValueService = (AggregatedDataValueService) getBean( AggregatedDataValueService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
+ {
// ---------------------------------------------------------------------
// Setup identifier Collections
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceOrgUnitTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceOrgUnitTest.java 2014-09-23 07:43:22 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceOrgUnitTest.java 2014-10-07 13:46:29 +0000
@@ -35,6 +35,7 @@
import java.util.HashSet;
import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.aggregation.AggregatedDataValueService;
import org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueService;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -58,6 +59,7 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.QuarterlyPeriodType;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* Note: Test using the default org unit level for org unit data mart which is 2.
@@ -68,11 +70,45 @@
public class DataMartServiceOrgUnitTest
extends DhisTest
{
+ @Autowired
+ private DataMartEngine dataMartEngine;
+
+ @Autowired
+ private AggregatedDataValueService aggregatedDataValueService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private AggregatedOrgUnitDataValueService aggregatedOrgUnitDataValueService;
+
+ @Autowired
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ @Autowired
+ private ExpressionService expressionService;
+
private final String T = "true";
private final String F = "false";
- private DataMartEngine dataMartEngine;
-
private DataElementCategoryCombo categoryCombo;
private DataElementCategoryOptionCombo categoryOptionCombo;
@@ -112,28 +148,6 @@
@Override
public void setUpTest()
{
- dataMartEngine = (DataMartEngine) getBean( DataMartEngine.ID );
-
- aggregatedOrgUnitDataValueService = (AggregatedOrgUnitDataValueService) getBean( AggregatedOrgUnitDataValueService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
- expressionService = (ExpressionService) getBean( ExpressionService.ID );
-
categoryCombo = categoryService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTest.java 2014-09-23 07:43:22 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTest.java 2014-10-07 13:46:29 +0000
@@ -45,7 +45,6 @@
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.expression.Expression;
-import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
@@ -57,6 +56,7 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.QuarterlyPeriodType;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -68,10 +68,33 @@
private final String T = "true";
private final String F = "false";
+ @Autowired
private DataMartEngine dataMartEngine;
+ @Autowired
private AggregatedDataValueService aggregatedDataValueService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private DataValueService dataValueService;
+ @Autowired
+ private DataElementCategoryService categoryService;
+
private DataElementCategoryCombo categoryCombo;
private DataElementCategoryOptionCombo categoryOptionCombo;
@@ -104,30 +127,10 @@
@Override
public void setUpTest()
{
- dataMartEngine = (DataMartEngine) getBean( DataMartEngine.ID );
-
- aggregatedDataValueService = (AggregatedDataValueService) getBean( AggregatedDataValueService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
- expressionService = (ExpressionService) getBean( ExpressionService.ID );
-
categoryCombo = categoryService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
-
+
// ---------------------------------------------------------------------
// Setup identifier Collections
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTimeDimensionTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTimeDimensionTest.java 2014-09-23 07:43:22 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartServiceTimeDimensionTest.java 2014-10-07 13:46:29 +0000
@@ -51,6 +51,7 @@
import org.hisp.dhis.period.QuarterlyPeriodType;
import org.hisp.dhis.period.YearlyPeriodType;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -59,10 +60,30 @@
public class DataMartServiceTimeDimensionTest
extends DhisTest
{
+ @Autowired
private DataMartEngine dataMartEngine;
-
+
+ @Autowired
private AggregatedDataValueService aggregatedDataValueService;
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
private DataElementCategoryCombo categoryCombo;
private DataElementCategoryOptionCombo categoryOptionCombo;
@@ -75,22 +96,6 @@
@Override
public void setUpTest()
{
- dataMartEngine = (DataMartEngine) getBean( DataMartEngine.ID );
-
- aggregatedDataValueService = (AggregatedDataValueService) getBean( AggregatedDataValueService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
categoryCombo = categoryService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabServiceTest.java 2014-10-07 13:46:29 +0000
@@ -38,6 +38,8 @@
import java.util.List;
import java.util.Map;
+import javax.annotation.Resource;
+
import org.amplecode.quick.BatchHandler;
import org.amplecode.quick.BatchHandlerFactory;
import org.apache.commons.lang.RandomStringUtils;
@@ -61,6 +63,7 @@
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.WeeklyPeriodType;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -69,8 +72,25 @@
public class CrossTabServiceTest
extends DhisTest
{
+ @Autowired
private CrossTabService crossTabService;
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
+ @Resource(name="inMemoryBatchHandlerFactory")
private BatchHandlerFactory batchHandlerFactory;
private Iterator<Period> generatedPeriods;
@@ -87,21 +107,7 @@
@Override
public void setUpTest()
- {
- crossTabService = (CrossTabService) getBean( CrossTabService.ID );
-
- batchHandlerFactory = (BatchHandlerFactory) getBean( "inMemoryBatchHandlerFactory" );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
+ {
Calendar calendar = Calendar.getInstance();
calendar.set( 2007, 0, 1 );
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabStoreTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabStoreTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/crosstab/CrossTabStoreTest.java 2014-10-07 13:46:29 +0000
@@ -36,14 +36,16 @@
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.datamart.crosstab.jdbc.CrossTabStore;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
public class CrossTabStoreTest
extends DhisTest
{
+ @Autowired
private CrossTabStore crossTabStore;
-
+
private List<DataElementOperand> operands;
-
+
private String key = RandomStringUtils.randomAlphanumeric( 8 );
// -------------------------------------------------------------------------
@@ -53,13 +55,11 @@
@Override
public void setUpTest()
{
- crossTabStore = (CrossTabStore) getBean( CrossTabStore.ID );
-
operands = new ArrayList<>();
operands.add( new DataElementOperand( "a", "a" ) );
operands.add( new DataElementOperand( "a", "b" ) );
operands.add( new DataElementOperand( "b", "a" ) );
- operands.add( new DataElementOperand( "b", "b" ) );
+ operands.add( new DataElementOperand( "b", "b" ) );
}
@Override
@@ -71,20 +71,20 @@
// -------------------------------------------------------------------------
// Tests
// -------------------------------------------------------------------------
-
+
@Test
public void testDropCrossTabTable()
{
crossTabStore.createCrossTabTable( operands, key );
-
+
crossTabStore.dropCrossTabTable( key );
}
-
+
@Test
public void testDropAggregatedDataCache()
{
crossTabStore.createAggregatedDataCache( operands, key );
-
+
crossTabStore.dropAggregatedDataCache( key );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java 2014-10-06 10:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/NoRegistrationSingleEventServiceTest.java 2014-10-07 13:46:29 +0000
@@ -74,6 +74,12 @@
@Autowired
private ProgramStageInstanceService programStageInstanceService;
+ @Autowired
+ private IdentifiableObjectManager _identifiableObjectManager;
+
+ @Autowired
+ private UserService _userService;
+
private OrganisationUnit organisationUnitA;
private DataElement dataElementA;
private Program programA;
@@ -82,8 +88,8 @@
@Override
protected void setUpTest() throws Exception
{
- identifiableObjectManager = (IdentifiableObjectManager) getBean( IdentifiableObjectManager.ID );
- userService = (UserService) getBean( UserService.ID );
+ identifiableObjectManager = _identifiableObjectManager;
+ userService = _userService;
organisationUnitA = createOrganisationUnit( 'A' );
identifiableObjectManager.save( organisationUnitA );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java 2014-10-06 10:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationMultiEventsServiceTest.java 2014-10-07 13:46:29 +0000
@@ -82,7 +82,13 @@
@Autowired
private SessionFactory sessionFactory;
-
+
+ @Autowired
+ private IdentifiableObjectManager _identifiableObjectManager;
+
+ @Autowired
+ private UserService _userService;
+
private org.hisp.dhis.trackedentity.TrackedEntityInstance maleA;
private org.hisp.dhis.trackedentity.TrackedEntityInstance maleB;
@@ -111,8 +117,8 @@
protected void setUpTest()
throws Exception
{
- identifiableObjectManager = (IdentifiableObjectManager) getBean( IdentifiableObjectManager.ID );
- userService = (UserService) getBean( UserService.ID );
+ identifiableObjectManager = _identifiableObjectManager;
+ userService = _userService;
organisationUnitA = createOrganisationUnit( 'A' );
organisationUnitB = createOrganisationUnit( 'B' );
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java 2014-10-06 10:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/RegistrationSingleEventServiceTest.java 2014-10-07 13:46:29 +0000
@@ -79,7 +79,13 @@
@Autowired
private EnrollmentService enrollmentService;
-
+
+ @Autowired
+ private IdentifiableObjectManager _identifiableObjectManager;
+
+ @Autowired
+ private UserService _userService;
+
private org.hisp.dhis.trackedentity.TrackedEntityInstance maleA;
private org.hisp.dhis.trackedentity.TrackedEntityInstance maleB;
private org.hisp.dhis.trackedentity.TrackedEntityInstance femaleA;
@@ -96,8 +102,8 @@
@Override
protected void setUpTest() throws Exception
{
- identifiableObjectManager = (IdentifiableObjectManager) getBean( IdentifiableObjectManager.ID );
- userService = (UserService) getBean( UserService.ID );
+ identifiableObjectManager = _identifiableObjectManager;
+ userService = _userService;
organisationUnitA = createOrganisationUnit( 'A' );
organisationUnitB = createOrganisationUnit( 'B' );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/analysis/ImportAnalyserTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/analysis/ImportAnalyserTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/analysis/ImportAnalyserTest.java 2014-10-07 13:46:29 +0000
@@ -41,6 +41,7 @@
import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -49,6 +50,7 @@
public class ImportAnalyserTest
extends DhisTest
{
+ @Autowired
private ExpressionService expressionService;
private ImportAnalyser analyser;
@@ -60,8 +62,6 @@
@Override
public void setUpTest()
{
- expressionService = (ExpressionService) getBean( ExpressionService.ID );
-
analyser = new DefaultImportAnalyser( expressionService );
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dhis14/Dhis14XmlImportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dhis14/Dhis14XmlImportServiceTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dhis14/Dhis14XmlImportServiceTest.java 2014-10-07 13:46:29 +0000
@@ -30,6 +30,8 @@
import java.io.InputStream;
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.importexport.ImportParams;
import org.hisp.dhis.importexport.ImportService;
@@ -41,6 +43,7 @@
public class Dhis14XmlImportServiceTest
extends DhisSpringTest
{
+ @Resource(name="org.hisp.dhis.importexport.Dhis14XMLImportService")
private ImportService importService;
private InputStream inputStream;
@@ -55,8 +58,6 @@
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
inputStream = classLoader.getResourceAsStream( "dhis14A.zip" );
-
- importService = (ImportService) getBean( "org.hisp.dhis.importexport.Dhis14XMLImportService" );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFOrganisationUnitsTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFOrganisationUnitsTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/DXFOrganisationUnitsTest.java 2014-10-07 13:46:29 +0000
@@ -37,11 +37,14 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
+import javax.annotation.Resource;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -53,7 +56,11 @@
{
private InputStream inputStream;
+ @Resource(name="org.hisp.dhis.importexport.ImportService")
private ImportService importService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
@Override
public void setUpTest() throws LocationManagerException, IOException
@@ -61,8 +68,6 @@
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
inputStream = classLoader.getResourceAsStream( "dxfOrganisationUnits.xml" );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
}
@Override
@@ -81,8 +86,6 @@
@Test
public void testImportOrganisationUnits() throws Exception
{
- importService = (ImportService) getBean( "org.hisp.dhis.importexport.ImportService" );
-
ImportParams params = ImportExportUtils.getImportParams( ImportStrategy.NEW_AND_UPDATES, false, false, false );
importService.importData( params, inputStream );
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/GML2DXFTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/GML2DXFTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/dxf/GML2DXFTest.java 2014-10-07 13:46:29 +0000
@@ -30,6 +30,8 @@
import java.io.InputStream;
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisTest;
import org.hisp.dhis.importexport.ImportParams;
import org.hisp.dhis.importexport.ImportService;
@@ -37,6 +39,7 @@
import org.hisp.dhis.importexport.util.ImportExportUtils;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import static org.junit.Assert.*;
@@ -46,8 +49,10 @@
public class GML2DXFTest
extends DhisTest
{
+ @Resource(name="org.hisp.dhis.importexport.ImportService")
private ImportService importService;
+ @Autowired
private OrganisationUnitService organisationUnitService;
private InputStream inputStream;
@@ -57,10 +62,6 @@
{
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- importService = (ImportService) getBean( "org.hisp.dhis.importexport.ImportService" );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
inputStream = classLoader.getResourceAsStream( "polygon.gml" );
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/mapping/ObjectMappingGeneratorTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/mapping/ObjectMappingGeneratorTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/mapping/ObjectMappingGeneratorTest.java 2014-10-07 13:46:29 +0000
@@ -46,6 +46,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
@@ -54,7 +55,20 @@
public class ObjectMappingGeneratorTest
extends DhisTest
{
+ @Autowired
private ObjectMappingGenerator objectMappingGenerator;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
// -------------------------------------------------------------------------
// Fixture
@@ -64,16 +78,6 @@
public void setUpTest()
{
NameMappingUtil.clearMapping();
-
- objectMappingGenerator = (ObjectMappingGenerator) getBean( ObjectMappingGenerator.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java 2014-10-07 13:46:29 +0000
@@ -28,6 +28,14 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorService;
@@ -41,11 +49,7 @@
import org.hisp.dhis.period.PeriodType;
import org.jfree.chart.JFreeChart;
import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.*;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -54,6 +58,16 @@
public class ChartServiceTest
extends DhisSpringTest
{
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
private ChartService chartService;
private Indicator indicatorA;
@@ -79,14 +93,6 @@
public void setUpTest()
throws Exception
{
- chartService = (ChartService) getBean( ChartService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
// ---------------------------------------------------------------------
// Indicator
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartStoreTest.java 2014-10-07 13:46:29 +0000
@@ -28,6 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.indicator.Indicator;
@@ -40,11 +50,7 @@
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.*;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -53,8 +59,19 @@
public class ChartStoreTest
extends DhisSpringTest
{
+ @Resource(name="org.hisp.dhis.chart.ChartStore")
private GenericIdentifiableObjectStore<Chart> chartStore;
-
+
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+
private Indicator indicatorA;
private Indicator indicatorB;
private Indicator indicatorC;
@@ -75,17 +92,8 @@
// -------------------------------------------------------------------------
@Override
- @SuppressWarnings("unchecked")
public void setUpTest()
{
- chartStore = (GenericIdentifiableObjectStore<Chart>) getBean( "org.hisp.dhis.chart.ChartStore" );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
// ---------------------------------------------------------------------
// Indicator
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceExportTest.java 2014-10-07 13:46:29 +0000
@@ -38,6 +38,7 @@
import org.hisp.dhis.period.*;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.Collection;
@@ -53,10 +54,22 @@
public class DataSetCompletenessServiceExportTest
extends DhisSpringTest
{
+ @Autowired
private DataSetCompletenessEngine completenessEngine;
+ @Autowired
private DataSetCompletenessStore completenessStore;
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
private CompleteDataSetRegistrationService registrationService;
private PeriodType monthly;
@@ -87,19 +100,7 @@
@Override
public void setUpTest()
- {
- completenessEngine = (DataSetCompletenessEngine) getBean( DataSetCompletenessEngine.ID );
-
- completenessStore = (DataSetCompletenessStore) getBean( DataSetCompletenessStore.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- registrationService = (CompleteDataSetRegistrationService) getBean( CompleteDataSetRegistrationService.ID );
-
+ {
dataSets = new ArrayList<>();
periods = new ArrayList<>();
units = new ArrayList<>();
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/completeness/DataSetCompletenessServiceTest.java 2014-10-07 13:46:29 +0000
@@ -43,12 +43,15 @@
import org.hisp.dhis.period.*;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
+import javax.annotation.Resource;
+
import static org.junit.Assert.*;
/**
@@ -59,12 +62,42 @@
public class DataSetCompletenessServiceTest
extends DhisSpringTest
{
- private LocationManager locationManager;
-
+ @Autowired
+ private DataSetCompletenessEngine completenessEngine;
+
+ @Autowired
+ private DataSetCompletenessStore completenessStore;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
private CompleteDataSetRegistrationService registrationService;
+ @Resource(name="locationManager")
+ LocationManager locationManager;
+
+ @Autowired
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private DataValueService dataValueService;
+
+ @Autowired
private DataSetCompletenessService registrationCompletenessService;
-
+
private PeriodType periodType;
private Period periodA;
@@ -117,28 +150,8 @@
@Override
public void setUpTest()
{
- locationManager = (LocationManager) getBean( "locationManager" );
-
setExternalTestDir( locationManager );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- dataValueService = (DataValueService) getBean( DataValueService.ID );
-
- registrationService = (CompleteDataSetRegistrationService) getBean( CompleteDataSetRegistrationService.ID );
-
- registrationCompletenessService = (DataSetCompletenessService) getBean( "registrationDataCompletenessService" );
-
+
categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
periodType = new MonthlyPeriodType();
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentServiceTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentServiceTest.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;
import java.util.Collection;
@@ -42,6 +43,7 @@
public class DocumentServiceTest
extends DhisSpringTest
{
+ @Autowired
private DocumentService documentService;
private Document documentA;
@@ -51,8 +53,6 @@
@Override
public void setUpTest()
{
- documentService = (DocumentService) getBean( DocumentService.ID );
-
documentA = new Document( "DocumentA", "UrlA", true, null );
documentB = new Document( "DocumentB", "UrlB", true, null );
documentC = new Document( "DocumentC", "UrlC", false, null );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.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,10 +45,10 @@
* @author Lars Helge Overland
* @version $Id$
*/
-@SuppressWarnings( "unchecked" )
public class DocumentStoreTest
extends DhisSpringTest
{
+ @Resource(name="org.hisp.dhis.document.DocumentStore")
private GenericIdentifiableObjectStore<Document> documentStore;
private Document documentA;
@@ -55,9 +57,7 @@
@Override
public void setUpTest()
- {
- documentStore = (GenericIdentifiableObjectStore<Document>) getBean( "org.hisp.dhis.document.DocumentStore" );
-
+ {
documentA = new Document( "DocumentA", "UrlA", true, null );
documentB = new Document( "DocumentB", "UrlB", true, null );
documentC = new Document( "DocumentC", "UrlC", false, null );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapLayerTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapLayerTest.java 2014-07-06 15:43:19 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapLayerTest.java 2014-10-07 13:46:29 +0000
@@ -52,6 +52,7 @@
import org.hisp.dhis.period.PeriodType;
import org.junit.Ignore;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Kenneth Solbø Andersen <kennetsa@xxxxxxxxxx>
@@ -59,11 +60,24 @@
public class GeoToolsMapLayerTest
extends DhisSpringTest
{
- private InternalMapLayer internalMapLayer;
-
+ @Autowired
private MappingService mappingService;
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private PeriodService periodService;
+
private OrganisationUnit organisationUnit;
+
+ private InternalMapLayer internalMapLayer;
private OrganisationUnitLevel organisationUnitLevel;
@@ -86,16 +100,6 @@
@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" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/MapGeneratorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/MapGeneratorServiceTest.java 2014-07-06 15:43:19 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/MapGeneratorServiceTest.java 2014-10-07 13:46:29 +0000
@@ -44,6 +44,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 Kenneth Solbø Andersen <kennetsa@xxxxxxxxxx>
@@ -51,6 +52,18 @@
public class MapGeneratorServiceTest
extends DhisSpringTest
{
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private PeriodService periodService;
+
private OrganisationUnit organisationUnit;
private OrganisationUnitLevel organisationUnitLevel;
@@ -72,14 +85,6 @@
@Override
public void setUpTest()
{
- 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" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/orgunitdistribution/OrgUnitDistributionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/orgunitdistribution/OrgUnitDistributionServiceTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/orgunitdistribution/OrgUnitDistributionServiceTest.java 2014-10-07 13:46:29 +0000
@@ -39,6 +39,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
@@ -46,23 +47,15 @@
public class OrgUnitDistributionServiceTest
extends DhisSpringTest
{
+ @Autowired
private OrganisationUnitService organisationUnitService;
+ @Autowired
private OrganisationUnitGroupService organisationUnitGroupService;
+ @Autowired
private OrgUnitDistributionService distributionService;
- @Override
- public void setUpTest()
- throws Exception
- {
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID );
-
- distributionService = (OrgUnitDistributionService) getBean( OrgUnitDistributionService.ID );
- }
-
@Test
public void testGetOrganisationUnitsByNameAndGroups()
{
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/report/ReportStoreTest.java 2014-10-07 13:46:29 +0000
@@ -28,29 +28,33 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.report.Report.TYPE_JASPER_REPORT_TABLE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.hisp.dhis.report.Report.TYPE_JASPER_REPORT_TABLE;
import java.util.Collection;
+import javax.annotation.Resource;
+
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.GenericStore;
import org.hisp.dhis.reporttable.ReportTable;
import org.hisp.dhis.reporttable.ReportTableService;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
*/
-@SuppressWarnings( "unchecked" )
public class ReportStoreTest
extends DhisSpringTest
{
+ @Resource(name="org.hisp.dhis.report.ReportStore")
private GenericStore<Report> reportStore;
+ @Autowired
private ReportTableService reportTableService;
private ReportTable reportTableA;
@@ -62,10 +66,6 @@
@Override
public void setUpTest()
{
- reportStore = (GenericStore<Report>) getBean( "org.hisp.dhis.report.ReportStore" );
-
- reportTableService = (ReportTableService) getBean( ReportTableService.ID );
-
reportTableA = new ReportTable();
reportTableA.setName( "ReportTableA" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableGridTest.java 2014-10-07 13:46:29 +0000
@@ -41,6 +41,8 @@
import java.util.Map;
import java.util.Set;
+import javax.annotation.Resource;
+
import org.amplecode.quick.BatchHandler;
import org.amplecode.quick.BatchHandlerFactory;
import org.hisp.dhis.DhisSpringTest;
@@ -76,6 +78,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
@@ -83,12 +86,37 @@
public class ReportTableGridTest
extends DhisSpringTest
{
+ @Autowired
private ReportTableService reportTableService;
+ @Autowired
+ private AnalyticsService analyticsService;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService;
+
+ @Autowired
+ OrganisationUnitGroupService organisationUnitGroupService;
+
+ @Resource( name = "batchHandlerFactory" )
private BatchHandlerFactory batchHandlerFactory;
- private AnalyticsService analyticsService;
-
+
private Map<String, Double> valueMap;
private List<DataElement> dataElements;
@@ -156,20 +184,6 @@
public void setUpTest()
throws Exception
{
- reportTableService = (ReportTableService) getBean( ReportTableService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
- dataSetService = (DataSetService) getBean( DataSetService.ID );
- periodService = (PeriodService) getBean( PeriodService.ID );
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
- organisationUnitGroupService = (OrganisationUnitGroupService) getBean( OrganisationUnitGroupService.ID );
-
- batchHandlerFactory = (BatchHandlerFactory) getBean( "batchHandlerFactory" );
-
dataElements = new ArrayList<>();
categoryOptionCombos = new ArrayList<>();
indicators = new ArrayList<>();
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2014-10-07 13:46:29 +0000
@@ -37,6 +37,8 @@
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.hisp.dhis.dataelement.DataElement;
@@ -54,16 +56,32 @@
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.RelativePeriods;
import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Lars Helge Overland
* @version $Id$
*/
-@SuppressWarnings( "unchecked" )
public class ReportTableStoreTest
extends DhisSpringTest
{
+ @Resource( name = "org.hisp.dhis.reporttable.ReportTableStore" )
private GenericIdentifiableObjectStore<ReportTable> reportTableStore;
+
+ @Autowired
+ private DataElementService dataElementService;
+
+ @Autowired
+ private IndicatorService indicatorService;
+
+ @Autowired
+ private DataSetService dataSetService;
+
+ @Autowired
+ private PeriodService periodService;
+
+ @Autowired
+ private OrganisationUnitService organisationUnitService ;
private IndicatorType indicatorType;
@@ -103,19 +121,7 @@
dataSets = new ArrayList<>();
periods = new ArrayList<>();
units = new ArrayList<>();
-
- reportTableStore = (GenericIdentifiableObjectStore<ReportTable>) getBean( "org.hisp.dhis.reporttable.ReportTableStore" );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- dataSetService = (DataSetService) getBean( DataSetService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
+
indicatorType = createIndicatorType( 'A' );
indicatorService.addIndicatorType( indicatorType );
=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2014-10-06 10:11:29 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2014-10-07 13:46:29 +0000
@@ -51,16 +51,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.aggregation.AggregatedDataValueService;
-import org.hisp.dhis.aggregation.AggregatedOrgUnitDataValueService;
import org.hisp.dhis.chart.Chart;
import org.hisp.dhis.common.DimensionalObject;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.concept.Concept;
import org.hisp.dhis.constant.Constant;
-import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.datadictionary.DataDictionary;
-import org.hisp.dhis.datadictionary.DataDictionaryService;
import org.hisp.dhis.dataelement.CategoryOptionGroup;
import org.hisp.dhis.dataelement.CategoryOptionGroupSet;
import org.hisp.dhis.dataelement.DataElement;
@@ -68,21 +64,12 @@
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementDomain;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementGroupSet;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataentryform.DataEntryFormService;
-import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.dataset.SectionService;
import org.hisp.dhis.datavalue.DataValue;
-import org.hisp.dhis.datavalue.DataValueAuditService;
-import org.hisp.dhis.datavalue.DataValueService;
import org.hisp.dhis.expression.Expression;
-import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.expression.Operator;
import org.hisp.dhis.external.location.LocationManager;
import org.hisp.dhis.importexport.ImportDataValue;
@@ -90,28 +77,20 @@
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.indicator.IndicatorGroup;
import org.hisp.dhis.indicator.IndicatorGroupSet;
-import org.hisp.dhis.indicator.IndicatorService;
import org.hisp.dhis.indicator.IndicatorType;
import org.hisp.dhis.mapping.MapLegend;
import org.hisp.dhis.mapping.MapLegendSet;
-import org.hisp.dhis.mapping.MappingService;
-import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-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.hisp.dhis.period.PeriodType;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
-import org.hisp.dhis.program.ProgramStageService;
import org.hisp.dhis.program.ProgramTrackedEntityAttribute;
import org.hisp.dhis.relationship.RelationshipType;
-import org.hisp.dhis.resourcetable.ResourceTableService;
import org.hisp.dhis.sqlview.SqlView;
import org.hisp.dhis.trackedentity.TrackedEntity;
import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
@@ -124,10 +103,8 @@
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserService;
import org.hisp.dhis.validation.ValidationCriteria;
-import org.hisp.dhis.validation.ValidationCriteriaService;
import org.hisp.dhis.validation.ValidationRule;
import org.hisp.dhis.validation.ValidationRuleGroup;
-import org.hisp.dhis.validation.ValidationRuleService;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -167,54 +144,8 @@
// Service references
// -------------------------------------------------------------------------
- protected DataElementService dataElementService;
-
- protected DataElementCategoryService categoryService;
-
- protected DataDictionaryService dataDictionaryService;
-
- protected IndicatorService indicatorService;
-
- protected DataSetService dataSetService;
-
- protected SectionService sectionService;
-
- protected CompleteDataSetRegistrationService completeDataSetRegistrationService;
-
- protected OrganisationUnitService organisationUnitService;
-
- protected OrganisationUnitGroupService organisationUnitGroupService;
-
- protected AggregatedDataValueService aggregatedDataValueService;
-
- protected AggregatedOrgUnitDataValueService aggregatedOrgUnitDataValueService;
-
- protected PeriodService periodService;
-
- protected ConstantService constantService;
-
- protected ValidationRuleService validationRuleService;
-
- protected ValidationCriteriaService validationCriteriaService;
-
- protected ExpressionService expressionService;
-
- protected DataValueService dataValueService;
-
- protected DataValueAuditService dataValueAuditService;
-
- protected ResourceTableService resourceTableService;
-
- protected MappingService mappingService;
-
- protected ProgramStageService programStageService;
-
- protected DataEntryFormService dataEntryFormService;
-
protected UserService userService;
-
- protected MessageService messageService;
-
+
protected IdentifiableObjectManager identifiableObjectManager;
static