dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07345
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2084: Increase unit test - DataBrowserServiceTest. And minor fixed in dataset section
------------------------------------------------------------
revno: 2084
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-09-08 18:00:18 +0700
message:
Increase unit test - DataBrowserServiceTest. And minor fixed in dataset section
modified:
dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/DataElementListFilteredByGroupForSection.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js
--
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 2010-09-08 05:46:03 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java 2010-09-08 11:00:18 +0000
@@ -31,8 +31,10 @@
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNotSame;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.period.MonthlyPeriodType;
import org.hisp.dhis.period.PeriodService;
-import org.junit.Ignore;
+import org.hisp.dhis.period.PeriodType;
import org.junit.Test;
/**
@@ -513,20 +515,22 @@
* format );
*/
@Test
- @Ignore
public void testConvertDate()
{
- // To do
- }
-
- /**
- * String getFromToDateFormat( PeriodType periodType, String fromDate,
- * String toDate, I18nFormat format );
- */
- @Test
- @Ignore
- public void getFromToDateFormat()
- {
- // To do
+ I18nFormat format = new I18nFormat();
+ PeriodType monthlyPeriodType = periodService.getPeriodTypeByName( MonthlyPeriodType.NAME );
+
+ // Get all children of unit B from 2005-03-01 to 2005-04-30 registered
+ // on monthly basis (this should be period A and B data values)
+ DataBrowserTable table = dataBrowserService.getOrgUnitsInPeriod( unitB.getId(), "2005-03-01", "2005-04-30",
+ periodA.getPeriodType(), 4 );
+
+ assertNotNull( "DataBrowserTable not supposed to be null", table );
+ assertEquals( "No. of queries", 3, table.getQueryCount() );
+ assertNotSame( "Querytime more than 0", 0, table.getQueryTime() );
+
+ assertEquals( "Metacolumns", 3, table.getColumns().size() );
+ assertEquals( "drilldown_organisation_unit", dataBrowserService.convertDate( monthlyPeriodType, table
+ .getColumns().get( 0 ).getName(), format ) );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/DataElementListFilteredByGroupForSection.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/DataElementListFilteredByGroupForSection.java 2010-09-07 05:24:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/DataElementListFilteredByGroupForSection.java 2010-09-08 11:00:18 +0000
@@ -147,7 +147,6 @@
public String execute()
throws Exception
{
-
// dataSetId
if ( dataSetId != null )
{
@@ -180,21 +179,6 @@
}
}
- // if ( dataElementGroupId == null || dataElementGroupId.equals( ALL ) )
- // {
- // dataElements = new ArrayList<DataElement>(
- // dataElementService.getAllActiveDataElements() );
- // }
- // else
- // {
- // DataElementGroup dataElementGroup =
- // dataElementService.getDataElementGroup( Integer
- // .parseInt( dataElementGroupId ) );
- //
- // dataElements = new ArrayList<DataElement>(
- // dataElementGroup.getMembers() );
- // }
-
// dataElementGroupId
if ( dataElementGroupId == null || dataElementGroupId.equals( ALL ) )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2010-09-07 05:24:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2010-09-08 11:00:18 +0000
@@ -76,7 +76,7 @@
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-dataset/editSection.vm</param>
<param name="menu">/dhis-web-maintenance-dataset/menu.vm</param>
- <param name="javascripts">javascript/dataSet.js</param>
+ <param name="javascripts">javascript/section.js</param>
</action>
<action name="updateSection"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm 2010-09-07 05:24:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editSection.vm 2010-09-08 11:00:18 +0000
@@ -20,6 +20,7 @@
<div style="display:inline">
<input type="hidden" id="dataSetId" name="dataSetId" value="$dataSet.id">
<input type="hidden" id="sectionId" name="sectionId" value="$section.id">
+ <input type="hidden" id="categoryComboId" name="categoryComboId" value="$categoryCombo.id">
</div>
<table id="detailsList">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js 2010-09-07 05:24:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js 2010-09-08 11:00:18 +0000
@@ -158,22 +158,25 @@
function filterByDataElementGroupForSection( groupId )
{
- var request = new Request();
-
- var requestString = 'filterDataElementsByDataElementGroupForSection.action';
-
- var params = getParamString( 'selectedList' );
- params += 'dataElementGroupId=' + groupId;
- params += '&dataSetId=' + getFieldValue( 'dataSetId' );
- params += '&categoryComboId=' + getFieldValue( 'categoryComboId' );
-
- // Clear the list
- clearListById( 'availableList' );
-
- request.setResponseTypeXML( 'dataElementGroup' );
- request.setCallbackSuccess( filterByDataElementGroupForSectionCompleted );
- request.sendAsPost( params );
- request.send( requestString );
+ var aSelectedList = new Array();
+ var selectedList = byId( 'selectedList' );
+
+ for ( var i = 0; i < selectedList.options.length; ++i)
+ {
+ aSelectedList.push( selectedList.options[i].value );
+ }
+
+ $.post("filterDataElementsByDataElementGroupForSection.action",
+ {
+ selectedList: aSelectedList,
+ dataElementGroupId: groupId,
+ dataSetId: getFieldValue( 'dataSetId' ),
+ categoryComboId: getFieldValue( 'categoryComboId' )
+ },
+ function (data)
+ {
+ filterByDataElementGroupForSectionCompleted( data );
+ }, 'xml');
}
function filterByDataElementGroupForSectionCompleted( dataElementGroup )
@@ -182,6 +185,7 @@
var dataElementList = dataElements.getElementsByTagName( 'dataElement' );
var availableList = byId( 'availableList' );
+ availableList.options.length = 0;
for ( var i = 0; i < dataElementList.length; i++ )
{