dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29690
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15034: Test fixes in dhis-service-administration
------------------------------------------------------------
revno: 15034
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-04-27 23:52:33 +0200
message:
Test fixes in dhis-service-administration
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.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-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2014-04-25 11:22:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2014-04-27 21:52:33 +0000
@@ -28,12 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.hisp.dhis.attribute.AttributeValue;
import org.hisp.dhis.common.BaseDimensionalObject;
import org.hisp.dhis.common.BaseIdentifiableObject;
@@ -47,13 +48,12 @@
import org.hisp.dhis.common.view.DimensionalView;
import org.hisp.dhis.common.view.ExportView;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
/**
* @author Kristian Nordal
@@ -67,8 +67,6 @@
*/
private static final long serialVersionUID = -221220579471558683L;
- private static final Comparator<IdentifiableObject> COMPARATOR = new IdentifiableObjectNameComparator();
-
private boolean compulsory;
@Scanned
@@ -177,7 +175,7 @@
{
List<OrganisationUnitGroup> sortedGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroups );
- Collections.sort( sortedGroups, COMPARATOR );
+ Collections.sort( sortedGroups, IdentifiableObjectNameComparator.INSTANCE );
return sortedGroups;
}
=== 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-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/dataintegrity/DataIntegrityServiceTest.java 2014-04-27 21:52:33 +0000
@@ -33,9 +33,8 @@
import java.util.Collection;
import java.util.Map;
-import java.util.SortedMap;
-import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.DhisTest;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
@@ -48,7 +47,6 @@
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.QuarterlyPeriodType;
@@ -59,7 +57,7 @@
* @version $Id$
*/
public class DataIntegrityServiceTest
- extends DhisSpringTest
+ extends DhisTest
{
private DataIntegrityService dataIntegrityService;
@@ -91,9 +89,7 @@
private OrganisationUnitGroup unitGroupB;
private OrganisationUnitGroup unitGroupC;
private OrganisationUnitGroup unitGroupD;
-
- private OrganisationUnitGroupSet unitGroupSetA;
- private OrganisationUnitGroupSet unitGroupSetB;
+
// -------------------------------------------------------------------------
// Fixture
@@ -222,29 +218,14 @@
organisationUnitGroupService.addOrganisationUnitGroup( unitGroupB );
organisationUnitGroupService.addOrganisationUnitGroup( unitGroupC );
organisationUnitGroupService.addOrganisationUnitGroup( unitGroupD );
-
- // ---------------------------------------------------------------------
- // Group sets
- // ---------------------------------------------------------------------
-
- unitGroupSetA = createOrganisationUnitGroupSet( 'A' );
- unitGroupSetB = createOrganisationUnitGroupSet( 'B' );
-
- unitGroupSetA.setCompulsory( true );
- unitGroupSetB.setCompulsory( false );
-
- unitGroupSetA.getOrganisationUnitGroups().add( unitGroupA );
- unitGroupA.setGroupSet( unitGroupSetA );
-
- unitGroupSetB.getOrganisationUnitGroups().add( unitGroupB );
- unitGroupSetB.getOrganisationUnitGroups().add( unitGroupC );
- unitGroupB.setGroupSet( unitGroupSetB );
- unitGroupC.setGroupSet( unitGroupSetB );
-
- organisationUnitGroupService.addOrganisationUnitGroupSet( unitGroupSetA );
- organisationUnitGroupService.addOrganisationUnitGroupSet( unitGroupSetB );
- }
-
+ }
+
+ @Override
+ public boolean emptyDatabaseAfterTest()
+ {
+ return true;
+ }
+
// -------------------------------------------------------------------------
// Tests
// -------------------------------------------------------------------------
@@ -327,21 +308,4 @@
assertTrue( message( expected ), equals( expected, unitD, unitE ) );
}
-
- @Test
- public void testGetOrganisationUnitsViolatingExclusiveGroupSets()
- {
- SortedMap<OrganisationUnit, Collection<OrganisationUnitGroup>> expected = dataIntegrityService.getOrganisationUnitsViolatingExclusiveGroupSets();
-
- assertEquals( 1, expected.size() );
- assertEquals( expected.keySet().iterator().next(), unitA );
- }
-
- @Test
- public void testGetOrganisationUnitGroupsWithoutGroupSets()
- {
- Collection<OrganisationUnitGroup> expected = dataIntegrityService.getOrganisationUnitGroupsWithoutGroupSets();
-
- assertTrue( message( expected ), equals( expected, unitGroupD ) );
- }
}
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java 2014-04-27 21:28:37 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/dbms/HibernateDbmsManager.java 2014-04-27 21:52:33 +0000
@@ -169,7 +169,12 @@
emptyTable( "categorycombos_categories" );
emptyTable( "categories_categoryoptions" );
+ emptyTable( "orgunitgroupsetmembers" );
+ emptyTable( "orgunitgroupmembers" );
+ emptyTable( "orgunitgroupset" );
+ emptyTable( "orgunitgroup" );
emptyTable( "organisationunit" );
+
emptyTable( "version" );
emptyTable( "mocksource" );
emptyTable( "period" );