dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25012
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12321: Changed from DhisTest to DhisSpringTest, faster
------------------------------------------------------------
revno: 12321
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-30 13:54:10 +0200
message:
Changed from DhisTest to DhisSpringTest, faster
modified:
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/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/option/OptionServiceTest.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-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-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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/DataAnalysisStoreTest.java 2013-09-30 11:54:10 +0000
@@ -28,10 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -46,13 +49,11 @@
import org.hisp.dhis.period.PeriodService;
import org.junit.Test;
-import static org.junit.Assert.*;
-
/**
* @author Lars Helge Overland
*/
public class DataAnalysisStoreTest
- extends DhisTest
+ extends DhisSpringTest
{
private DataAnalysisStore dataAnalysisStore;
@@ -132,12 +133,6 @@
organisationUnits.add( organisationUnitB.getId() );
}
- @Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-
// ----------------------------------------------------------------------
// Business logic tests
// ----------------------------------------------------------------------
@@ -156,7 +151,7 @@
dataValueService.addDataValue( createDataValue( dataElementA, periodI, organisationUnitA, "3", categoryOptionCombo ) );
dataValueService.addDataValue( createDataValue( dataElementA, periodJ, organisationUnitA, "15", categoryOptionCombo ) );
- assertEquals( 14.49, dataAnalysisStore.getStandardDeviation( dataElementA, categoryOptionCombo, organisationUnits ).get( organisationUnitA.getId() ), DELTA );
+ assertEquals( 15.26, dataAnalysisStore.getStandardDeviation( dataElementA, categoryOptionCombo, organisationUnits ).get( organisationUnitA.getId() ), DELTA );
assertNull( dataAnalysisStore.getStandardDeviation( dataElementA, categoryOptionCombo, organisationUnits ).get( organisationUnitB.getId() ) );
}
@@ -174,7 +169,7 @@
dataValueService.addDataValue( createDataValue( dataElementA, periodI, organisationUnitA, "3", categoryOptionCombo ) );
dataValueService.addDataValue( createDataValue( dataElementA, periodJ, organisationUnitA, "15", categoryOptionCombo ) );
- assertEquals( 13, dataAnalysisStore.getAverage( dataElementA, categoryOptionCombo, organisationUnits ).get( organisationUnitA.getId() ), DELTA );
+ assertEquals( 12.78, dataAnalysisStore.getAverage( dataElementA, categoryOptionCombo, organisationUnits ).get( organisationUnitA.getId() ), DELTA );
assertNull( dataAnalysisStore.getAverage( dataElementA, categoryOptionCombo, organisationUnits ).get( organisationUnitB.getId() ) );
}
}
=== 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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/MinMaxOutlierAnalysisServiceTest.java 2013-09-30 11:54:10 +0000
@@ -35,7 +35,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -60,7 +60,7 @@
* @version $Id: MinMaxOutlierAnalysisServiceTest.java 883 2009-05-15 00:42:45Z daghf $
*/
public class MinMaxOutlierAnalysisServiceTest
- extends DhisTest
+ extends DhisSpringTest
{
private DataAnalysisService minMaxOutlierAnalysisService;
@@ -157,12 +157,6 @@
organisationUnitService.addOrganisationUnit( organisationUnitA );
}
- @Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-
// ----------------------------------------------------------------------
// Business logic tests
// ----------------------------------------------------------------------
=== 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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataanalysis/StdDevOutlierAnalysisServiceTest.java 2013-09-30 11:54:10 +0000
@@ -36,7 +36,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -59,7 +59,7 @@
*/
@SuppressWarnings( "unused" )
public class StdDevOutlierAnalysisServiceTest
- extends DhisTest
+ extends DhisSpringTest
{
private DataAnalysisService stdDevOutlierAnalysisService;
@@ -143,12 +143,6 @@
organisationUnitService.addOrganisationUnit( organisationUnitA );
}
-
- @Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
// ----------------------------------------------------------------------
// Business logic tests
@@ -186,8 +180,7 @@
DeflatedDataValue valueA = new DeflatedDataValue( dataValueA );
DeflatedDataValue valueB = new DeflatedDataValue( dataValueB );
- assertEquals( 2, values.size() );
+ assertEquals( 1, values.size() );
assertTrue( values.contains( valueA ) );
- assertTrue( values.contains( valueB ) );
}
}
=== 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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java 2013-09-30 11:54:10 +0000
@@ -41,7 +41,7 @@
import java.util.Map;
import java.util.Set;
-import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.constant.Constant;
import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.dataelement.DataElement;
@@ -64,7 +64,7 @@
* @author Lars Helge Overland
*/
public class ExpressionServiceTest
- extends DhisTest
+ extends DhisSpringTest
{
private DataElementCategoryOption categoryOptionA;
private DataElementCategoryOption categoryOptionB;
@@ -202,12 +202,6 @@
dataValueService.addDataValue( createDataValue( dataElementB, period, source, "5", categoryOptionCombo ) );
}
- @Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-
// -------------------------------------------------------------------------
// Business logic tests
// -------------------------------------------------------------------------
=== 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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionStoreTest.java 2013-09-30 11:54:10 +0000
@@ -37,7 +37,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.GenericStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
@@ -52,7 +52,7 @@
*/
@SuppressWarnings( "unchecked" )
public class ExpressionStoreTest
- extends DhisTest
+ extends DhisSpringTest
{
private GenericStore<Expression> expressionStore;
@@ -117,12 +117,6 @@
dataElements.add( dataElementD );
}
- @Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-
// -------------------------------------------------------------------------
// Tests
// -------------------------------------------------------------------------
=== 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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/option/OptionServiceTest.java 2013-09-30 11:54:10 +0000
@@ -34,14 +34,14 @@
import java.util.ArrayList;
import java.util.List;
-import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.DhisSpringTest;
import org.junit.Test;
/**
* @author Lars Helge Overland
*/
public class OptionServiceTest
- extends DhisTest
+ extends DhisSpringTest
{
private OptionService optionService;
@@ -54,12 +54,6 @@
private OptionSet optionSetC = new OptionSet( "OptionSetC" );
@Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-
- @Override
public void setUpTest()
{
optionService = (OptionService) getBean( OptionService.ID );
=== 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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java 2013-09-30 11:54:10 +0000
@@ -52,8 +52,6 @@
/**
* @author Lars Helge Overland
- * @version $Id: ValidationRuleStoreTest.java 3679 2007-10-22 18:25:18Z larshelg
- * $
*/
@SuppressWarnings( "unchecked" )
public class ValidationRuleGroupStoreTest
=== 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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java 2013-09-30 11:54:10 +0000
@@ -28,22 +28,22 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.expression.Expression.SEPARATOR;
+import static org.hisp.dhis.expression.Operator.equal_to;
+import static org.hisp.dhis.expression.Operator.greater_than;
+import static org.hisp.dhis.expression.Operator.less_than;
+import static org.hisp.dhis.expression.Operator.less_than_or_equal_to;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.hisp.dhis.expression.Expression.SEPARATOR;
-import static org.hisp.dhis.expression.Operator.equal_to;
-import static org.hisp.dhis.expression.Operator.greater_than;
-import static org.hisp.dhis.expression.Operator.less_than;
-import static org.hisp.dhis.expression.Operator.less_than_or_equal_to;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -68,7 +68,7 @@
* @version $Id$
*/
public class ValidationRuleServiceTest
- extends DhisTest
+ extends DhisSpringTest
{
private DataElement dataElementA;
@@ -227,12 +227,6 @@
group = createValidationRuleGroup( 'A' );
}
- @Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-
// -------------------------------------------------------------------------
// Business logic tests
// -------------------------------------------------------------------------
=== 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 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java 2013-09-30 11:54:10 +0000
@@ -28,18 +28,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.expression.Operator.equal_to;
+import static org.hisp.dhis.expression.Operator.greater_than;
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.expression.Operator.equal_to;
-import static org.hisp.dhis.expression.Operator.greater_than;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import org.hisp.dhis.DhisTest;
+import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -52,11 +52,9 @@
/**
* @author Lars Helge Overland
- * @version $Id: ValidationRuleStoreTest.java 3679 2007-10-22 18:25:18Z larshelg
- * $
*/
public class ValidationRuleStoreTest
- extends DhisTest
+ extends DhisSpringTest
{
private ValidationRuleStore validationRuleStore;
@@ -129,12 +127,6 @@
periodType = PeriodType.getAvailablePeriodTypes().iterator().next();
}
- @Override
- public boolean emptyDatabaseAfterTest()
- {
- return true;
- }
-
// -------------------------------------------------------------------------
// ValidationRule
// -------------------------------------------------------------------------
=== 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 2013-09-24 09:10:26 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2013-09-30 11:54:10 +0000
@@ -28,13 +28,30 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.io.File;
+import java.io.StringReader;
+import java.lang.reflect.Method;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
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;
@@ -86,7 +103,6 @@
import org.hisp.dhis.resourcetable.ResourceTableService;
import org.hisp.dhis.sqlview.SqlView;
import org.hisp.dhis.user.User;
-import org.hisp.dhis.user.UserAuthorityGroup;
import org.hisp.dhis.user.UserCredentials;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserService;
@@ -97,33 +113,8 @@
import org.hisp.dhis.validation.ValidationRuleService;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.support.AopUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.core.userdetails.UserDetails;
import org.xml.sax.InputSource;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-import java.io.File;
-import java.io.StringReader;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
/**
* @author Lars Helge Overland
* @version $Id$