dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01443
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 445: Improved tests or ReportTable
------------------------------------------------------------
revno: 445
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-07-08 20:14:14 +0200
message:
Improved tests or ReportTable
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableColumn.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java
local/in/dhis-web-mobile/src/main/java/org/hisp/dhis/sandbox/mobileimport/action/MobileHomePageAction.java
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2009-05-19 10:46:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2009-07-08 18:14:14 +0000
@@ -645,7 +645,7 @@
return buffer.length() > 0 ? buffer.substring( 0, buffer.lastIndexOf( SPACE ) ) : buffer.toString();
}
-
+
private String getColumnName( MetaObject metaObject, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit unit )
{
StringBuffer buffer = new StringBuffer();
@@ -676,7 +676,7 @@
if ( buffer.length() > 0 && buffer.substring( 0, 1 ).matches( REGEX_NUMERIC ) )
{
buffer.insert( 0, SEPARATOR );
- }
+ }
return buffer.length() > 0 ? buffer.substring( 0, buffer.lastIndexOf( SEPARATOR ) ) : buffer.toString();
}
@@ -1056,6 +1056,11 @@
return crossTabColumns;
}
+ public Map<String, String> getPrettyCrossTabColumns()
+ {
+ return prettyCrossTabColumns;
+ }
+
public List<String> getCrossTabIdentifiers()
{
return crossTabIdentifiers;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableColumn.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableColumn.java 2009-05-19 08:43:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableColumn.java 2009-07-08 18:14:14 +0000
@@ -57,6 +57,16 @@
}
// -------------------------------------------------------------------------
+ // equals
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String toString()
+ {
+ return "[" + name + ", " + header + "]";
+ }
+
+ // -------------------------------------------------------------------------
// Getters and setters
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableTest.java 2009-07-08 18:14:14 +0000
@@ -34,6 +34,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.hisp.dhis.DhisTest;
import org.hisp.dhis.dataelement.DataElement;
@@ -245,6 +246,16 @@
assertTrue( reportTable.getReportIndicators().contains( null ) );
assertTrue( reportTable.getReportPeriods().contains( null ) );
assertTrue( reportTable.getReportUnits().size() == 2 );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 8, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -294,6 +305,16 @@
assertTrue( reportTable.getReportIndicators().size() == 2 );
assertTrue( reportTable.getReportPeriods().size() == 4 );
assertTrue( reportTable.getReportUnits().contains( null ) );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 2, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -347,6 +368,16 @@
assertTrue( reportTable.getReportIndicators().contains( null ) );
assertTrue( reportTable.getReportPeriods().size() == 4 );
assertTrue( reportTable.getReportUnits().contains( null ) );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 4, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -404,6 +435,16 @@
assertTrue( reportTable.getReportIndicators().contains( null ) );
assertTrue( reportTable.getReportPeriods().contains( null ) );
assertTrue( reportTable.getReportUnits().size() == 2 );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 8, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -454,6 +495,16 @@
assertTrue( reportTable.getReportIndicators().size() == 2 );
assertTrue( reportTable.getReportPeriods().size() == 4 );
assertTrue( reportTable.getReportUnits().contains( null ) );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 2, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -507,6 +558,16 @@
assertTrue( reportTable.getReportIndicators().contains( null ) );
assertTrue( reportTable.getReportPeriods().size() == 4 );
assertTrue( reportTable.getReportUnits().contains( null ) );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 4, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -578,6 +639,16 @@
assertTrue( reportTable.getReportIndicators().contains( null ) );
assertTrue( reportTable.getReportPeriods().contains( null ) );
assertTrue( reportTable.getReportUnits().size() == 2 );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 16, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -633,6 +704,16 @@
assertTrue( reportTable.getReportIndicators().size() == 2 );
assertTrue( reportTable.getReportPeriods().size() == 4 );
assertTrue( reportTable.getReportUnits().contains( null ) );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 4, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -688,6 +769,16 @@
assertTrue( reportTable.getReportIndicators().contains( null ) );
assertTrue( reportTable.getReportPeriods().size() == 4 );
assertTrue( reportTable.getReportUnits().contains( null ) );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 4, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -744,6 +835,16 @@
assertTrue( reportTable.getReportIndicators().contains( null ) );
assertTrue( reportTable.getReportPeriods().contains( null ) );
assertTrue( reportTable.getReportUnits().size() == 2 );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 8, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -793,6 +894,16 @@
assertTrue( reportTable.getReportIndicators().size() == 2 );
assertTrue( reportTable.getReportPeriods().size() == 4 );
assertTrue( reportTable.getReportUnits().contains( null ) );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 2, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
@Test
@@ -846,5 +957,15 @@
assertTrue( reportTable.getReportIndicators().contains( null ) );
assertTrue( reportTable.getReportPeriods().size() == 4 );
assertTrue( reportTable.getReportUnits().contains( null ) );
+
+ Map<String, String> prettyCrossTabColumns = reportTable.getPrettyCrossTabColumns();
+
+ assertNotNull( prettyCrossTabColumns );
+ assertEquals( 4, prettyCrossTabColumns.size() );
+
+ List<ReportTableColumn> filledDisplayColumns = reportTable.getFilledDisplayColumns();
+
+ assertNotNull( filledDisplayColumns );
+ assertEquals( reportTable.getAllColumns().size(), filledDisplayColumns.size() );
}
}
=== modified file 'local/in/dhis-web-mobile/src/main/java/org/hisp/dhis/sandbox/mobileimport/action/MobileHomePageAction.java'
--- local/in/dhis-web-mobile/src/main/java/org/hisp/dhis/sandbox/mobileimport/action/MobileHomePageAction.java 2009-07-08 09:58:18 +0000
+++ local/in/dhis-web-mobile/src/main/java/org/hisp/dhis/sandbox/mobileimport/action/MobileHomePageAction.java 2009-07-08 18:14:14 +0000
@@ -4,7 +4,8 @@
import com.opensymphony.xwork.Action;
-public class MobileHomePageAction implements Action
+public class MobileHomePageAction
+ implements Action
{
public String execute()
@@ -12,6 +13,5 @@
{
return SUCCESS;
}
-
}
--
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.