~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.hisp.dhis.databrowser;
 
2
 
 
3
/*
 
4
 * Copyright (c) 2004-2008, University of Oslo
 
5
 * All rights reserved.
 
6
 *
 
7
 * Redistribution and use in source and binary forms, with or without
 
8
 * modification, are permitted provided that the following conditions are met:
 
9
 * * Redistributions of source code must retain the above copyright notice, this
 
10
 *   list of conditions and the following disclaimer.
 
11
 * * Redistributions in binary form must reproduce the above copyright notice,
 
12
 *   this list of conditions and the following disclaimer in the documentation
 
13
 *   and/or other materials provided with the distribution.
 
14
 * * Neither the name of the HISP project nor the names of its contributors may
 
15
 *   be used to endorse or promote products derived from this software without
 
16
 *   specific prior written permission.
 
17
 *
 
18
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 
19
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 
20
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 
21
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 
22
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 
23
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 
24
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 
25
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 
27
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
28
 */
 
29
 
 
30
import java.util.Collection;
 
31
import java.util.Date;
 
32
import java.util.HashSet;
 
33
import java.util.Iterator;
 
34
 
 
35
import org.hisp.dhis.DhisConvenienceTest;
 
36
import org.hisp.dhis.dataelement.DataElement;
 
37
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 
38
import org.hisp.dhis.dataelement.DataElementCategoryComboService;
 
39
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 
40
import org.hisp.dhis.dataelement.DataElementCategoryOptionComboService;
 
41
import org.hisp.dhis.dataelement.DataElementService;
 
42
import org.hisp.dhis.dataset.DataSet;
 
43
import org.hisp.dhis.dataset.DataSetService;
 
44
import org.hisp.dhis.datavalue.DataValueService;
 
45
import org.hisp.dhis.indicator.IndicatorService;
 
46
import org.hisp.dhis.organisationunit.OrganisationUnit;
 
47
import org.hisp.dhis.organisationunit.OrganisationUnitService;
 
48
import org.hisp.dhis.period.Period;
 
49
import org.hisp.dhis.period.PeriodService;
 
50
import org.hisp.dhis.period.PeriodType;
 
51
 
 
52
/**
 
53
 * @author Joakim Bj�rnstad
 
54
 * @version $Id$
 
55
 */
 
56
public class DataBrowserServiceTest
 
57
    extends DhisConvenienceTest
 
58
{
 
59
    private DataBrowserService dataBrowserService;
 
60
 
 
61
    private final String T = "true";
 
62
    private final String F = "false";
 
63
 
 
64
    private DataElementCategoryCombo categoryCombo;
 
65
 
 
66
    private DataElementCategoryOptionCombo categoryOptionCombo;
 
67
 
 
68
    private Collection<Integer> dataElementIds;
 
69
 
 
70
    private Collection<Integer> periodIds;
 
71
 
 
72
    private Collection<Integer> organisationUnitIds;
 
73
 
 
74
    private DataSet dataSetA;
 
75
    private DataSet dataSetB;
 
76
 
 
77
    private DataElement dataElementA;
 
78
    private DataElement dataElementB;
 
79
 
 
80
    private Period periodA;
 
81
    private Period periodB;
 
82
    private Period periodC;
 
83
    private Period periodD;
 
84
 
 
85
    private OrganisationUnit unitA;
 
86
    private OrganisationUnit unitB;
 
87
    private OrganisationUnit unitC;
 
88
    private OrganisationUnit unitD;
 
89
    private OrganisationUnit unitE;
 
90
    private OrganisationUnit unitF;
 
91
    private OrganisationUnit unitG;
 
92
    private OrganisationUnit unitH;
 
93
    private OrganisationUnit unitI;
 
94
 
 
95
    public void setUpTest()
 
96
        throws Exception
 
97
    {
 
98
        dataBrowserService = (DataBrowserService) getBean( DataBrowserService.ID );
 
99
 
 
100
        categoryOptionComboService = (DataElementCategoryOptionComboService) getBean( DataElementCategoryOptionComboService.ID );
 
101
 
 
102
        categoryComboService = (DataElementCategoryComboService) getBean( DataElementCategoryComboService.ID );
 
103
 
 
104
        dataSetService = (DataSetService) getBean( DataSetService.ID );
 
105
 
 
106
        dataElementService = (DataElementService) getBean( DataElementService.ID );
 
107
 
 
108
        indicatorService = (IndicatorService) getBean( IndicatorService.ID );
 
109
 
 
110
        periodService = (PeriodService) getBean( PeriodService.ID );
 
111
 
 
112
        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
 
113
 
 
114
        dataValueService = (DataValueService) getBean( DataValueService.ID );
 
115
 
 
116
        categoryCombo = categoryComboService.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
 
117
 
 
118
        categoryOptionCombo = categoryOptionComboService.getDefaultDataElementCategoryOptionCombo();
 
119
 
 
120
        // ---------------------------------------------------------------------
 
121
        // Setup identifier Collections
 
122
        // ---------------------------------------------------------------------
 
123
 
 
124
        dataElementIds = new HashSet<Integer>();
 
125
        periodIds = new HashSet<Integer>();
 
126
        organisationUnitIds = new HashSet<Integer>();
 
127
 
 
128
        // ---------------------------------------------------------------------
 
129
        // Setup DataElements
 
130
        // ---------------------------------------------------------------------
 
131
 
 
132
        dataElementA = createDataElement( 'A', DataElement.TYPE_INT, DataElement.AGGREGATION_OPERATOR_SUM, categoryCombo );
 
133
        dataElementB = createDataElement( 'B', DataElement.TYPE_BOOL, DataElement.AGGREGATION_OPERATOR_SUM, categoryCombo );
 
134
 
 
135
        Collection<DataElement> dataElementsA = new HashSet<DataElement>();
 
136
        dataElementsA.add( dataElementA );
 
137
        Collection<DataElement> dataElementsB = new HashSet<DataElement>();
 
138
        dataElementsB.add( dataElementB );
 
139
 
 
140
        dataElementIds.add( dataElementService.addDataElement( dataElementA ) );
 
141
        dataElementIds.add( dataElementService.addDataElement( dataElementB ) );
 
142
 
 
143
        // ---------------------------------------------------------------------
 
144
        // Setup Periods
 
145
        // ---------------------------------------------------------------------
 
146
 
 
147
        Iterator<PeriodType> periodTypeIt = periodService.getAllPeriodTypes().iterator();
 
148
        PeriodType periodTypeA = periodTypeIt.next();
 
149
        PeriodType periodTypeB = periodTypeIt.next();
 
150
 
 
151
        Date mar01 = getDate( 2005, 3, 1 );
 
152
        Date mar31 = getDate( 2005, 3, 31 );
 
153
        Date apr01 = getDate( 2005, 4, 1 );
 
154
        Date apr30 = getDate( 2005, 4, 30 );
 
155
        Date may01 = getDate( 2005, 5, 1 );
 
156
        Date may31 = getDate( 2005, 5, 31 );
 
157
 
 
158
        periodA = createPeriod( periodTypeA, mar01, mar31 );
 
159
        periodB = createPeriod( periodTypeA, apr01, apr30 );
 
160
        periodC = createPeriod( periodTypeB, may01, may31 );
 
161
        periodD = createPeriod( periodTypeB, mar01, may31 );
 
162
 
 
163
        periodIds.add( periodService.addPeriod( periodA ) );
 
164
        periodIds.add( periodService.addPeriod( periodB ) );
 
165
        periodIds.add( periodService.addPeriod( periodC ) );
 
166
        periodIds.add( periodService.addPeriod( periodD ) );
 
167
 
 
168
        // ---------------------------------------------------------------------
 
169
        // Setup DataSets
 
170
        // ---------------------------------------------------------------------
 
171
 
 
172
        dataSetA = createDataSet( 'A', periodTypeA );
 
173
        dataSetB = createDataSet( 'B', periodTypeB );
 
174
 
 
175
        dataSetA.setDataElements( dataElementsA );
 
176
        dataSetB.setDataElements( dataElementsB );
 
177
 
 
178
        dataSetService.addDataSet( dataSetA );
 
179
        dataSetService.addDataSet( dataSetB );
 
180
 
 
181
        // ---------------------------------------------------------------------
 
182
        // Setup OrganisationUnits
 
183
        // ---------------------------------------------------------------------
 
184
 
 
185
        unitA = createOrganisationUnit( 'A' );
 
186
        unitB = createOrganisationUnit( 'B', unitA );
 
187
        unitC = createOrganisationUnit( 'C', unitA );
 
188
        unitD = createOrganisationUnit( 'D', unitB );
 
189
        unitE = createOrganisationUnit( 'E', unitB );
 
190
        unitF = createOrganisationUnit( 'F', unitB );
 
191
        unitG = createOrganisationUnit( 'G', unitF );
 
192
        unitH = createOrganisationUnit( 'H', unitF );
 
193
        unitI = createOrganisationUnit( 'I' );
 
194
 
 
195
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitA ) );
 
196
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitB ) );
 
197
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitC ) );
 
198
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitD ) );
 
199
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitE ) );
 
200
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitF ) );
 
201
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitG ) );
 
202
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitH ) );
 
203
        organisationUnitIds.add( organisationUnitService.addOrganisationUnit( unitI ) );
 
204
 
 
205
        organisationUnitService.addOrganisationUnitHierarchy( new Date() ); // TODO
 
206
 
 
207
        // ---------------------------------------------------------------------
 
208
        // Setup DataValues
 
209
        // ---------------------------------------------------------------------
 
210
 
 
211
        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitC, "90", categoryOptionCombo ) );
 
212
        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitD, "10", categoryOptionCombo ) );
 
213
        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitE, "35", categoryOptionCombo ) );
 
214
        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitF, "25", categoryOptionCombo ) );
 
215
        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitG, "20", categoryOptionCombo ) );
 
216
        dataValueService.addDataValue( createDataValue( dataElementA, periodA, unitH, "60", categoryOptionCombo ) );
 
217
 
 
218
        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitC, "70", categoryOptionCombo ) );
 
219
        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitD, "40", categoryOptionCombo ) );
 
220
        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitE, "65", categoryOptionCombo ) );
 
221
        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitF, "55", categoryOptionCombo ) );
 
222
        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitG, "20", categoryOptionCombo ) );
 
223
        dataValueService.addDataValue( createDataValue( dataElementA, periodB, unitH, "15", categoryOptionCombo ) );
 
224
 
 
225
        dataValueService.addDataValue( createDataValue( dataElementA, periodC, unitC, "95", categoryOptionCombo ) );
 
226
        dataValueService.addDataValue( createDataValue( dataElementA, periodC, unitD, "40", categoryOptionCombo ) );
 
227
        dataValueService.addDataValue( createDataValue( dataElementA, periodC, unitE, "45", categoryOptionCombo ) );
 
228
        dataValueService.addDataValue( createDataValue( dataElementA, periodC, unitF, "30", categoryOptionCombo ) );
 
229
        dataValueService.addDataValue( createDataValue( dataElementA, periodC, unitG, "50", categoryOptionCombo ) );
 
230
        dataValueService.addDataValue( createDataValue( dataElementA, periodC, unitH, "70", categoryOptionCombo ) );
 
231
 
 
232
        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitC, T, categoryOptionCombo ) );
 
233
        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitD, T, categoryOptionCombo ) );
 
234
        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitE, F, categoryOptionCombo ) );
 
235
        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitF, T, categoryOptionCombo ) );
 
236
        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitG, F, categoryOptionCombo ) );
 
237
        dataValueService.addDataValue( createDataValue( dataElementB, periodA, unitH, T, categoryOptionCombo ) );
 
238
 
 
239
        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitC, T, categoryOptionCombo ) );
 
240
        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitD, F, categoryOptionCombo ) );
 
241
        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitE, T, categoryOptionCombo ) );
 
242
        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitF, T, categoryOptionCombo ) );
 
243
        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitG, F, categoryOptionCombo ) );
 
244
        dataValueService.addDataValue( createDataValue( dataElementB, periodB, unitH, T, categoryOptionCombo ) );
 
245
 
 
246
        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitC, F, categoryOptionCombo ) );
 
247
        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitD, T, categoryOptionCombo ) );
 
248
        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitE, F, categoryOptionCombo ) );
 
249
        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitF, T, categoryOptionCombo ) );
 
250
        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitG, T, categoryOptionCombo ) );
 
251
        dataValueService.addDataValue( createDataValue( dataElementB, periodC, unitH, T, categoryOptionCombo ) );
 
252
 
 
253
    }
 
254
 
 
255
    public void testGetAllCountDataSetsByPeriodType()
 
256
    {
 
257
        DataBrowserTable table = dataBrowserService.getAllCountDataSetsByPeriodType( periodA.getPeriodType() );
 
258
        assertNotNull( "DataBrowserTable not supposed to be null", table );
 
259
        assertEquals( "No. of queries", 1, table.getQueryCount() );
 
260
        assertNotSame( "Querytime more than 0", 0, table.getQueryTime() );
 
261
 
 
262
        assertEquals( "Metarows", 2, table.getRows().size() );
 
263
        assertEquals( dataSetA.getName(), table.getRows().get( 0 ).getName() );
 
264
        assertEquals( dataSetA.getId(), table.getRows().get( 0 ).getId().intValue() );
 
265
        assertEquals( dataSetB.getName(), table.getRows().get( 1 ).getName() );
 
266
        assertEquals( dataSetB.getId(), table.getRows().get( 1 ).getId().intValue() );
 
267
 
 
268
        assertEquals( "Metacolumns", 2, table.getColumns().size() );
 
269
 
 
270
        assertEquals( "Row count entries", 2, table.getCounts().size() );
 
271
        assertEquals( "DataValues in dataSetA", 12, table.getRowBasedOnRowName( dataSetA.getName() ).get( 0 )
 
272
            .intValue() );
 
273
        assertEquals( "DataValues in dataSetB", 12, table.getRowBasedOnRowName( dataSetB.getName() ).get( 0 )
 
274
            .intValue() );
 
275
 
 
276
    }
 
277
 
 
278
    public void testGetAllCountDataElementsByPeriodType()
 
279
    {
 
280
        DataBrowserTable table = dataBrowserService.getAllCountDataElementsByPeriodType( dataSetA.getId(), periodA
 
281
            .getPeriodType() );
 
282
        assertNotNull( "DataBrowserTable not supposed to be null", table );
 
283
        assertEquals( "No. of queries", 3, table.getQueryCount() );
 
284
        assertNotSame( "Querytime more than 0", 0, table.getQueryTime() );
 
285
 
 
286
        assertEquals( "Metarows", 1, table.getRows().size() );
 
287
        assertEquals( dataElementA.getName(), table.getRows().get( 0 ).getName() );
 
288
        assertEquals( dataElementA.getId(), table.getRows().get( 0 ).getId().intValue() );
 
289
 
 
290
        assertEquals( "Metacolumns", 3, table.getColumns().size() );
 
291
 
 
292
        assertEquals( "Row count entries", 1, table.getCounts().size() );
 
293
        assertEquals( "DataValues in periodA", 6, table.getRowBasedOnRowName( dataElementA.getName() ).get( 0 )
 
294
            .intValue() );
 
295
        assertEquals( "DataValues in periodB", 6, table.getRowBasedOnRowName( dataElementA.getName() ).get( 1 )
 
296
            .intValue() );
 
297
    }
 
298
 
 
299
    public void testGetAllCountOrgUnitsByPeriodType()
 
300
    {
 
301
        DataBrowserTable table = dataBrowserService.getAllCountOrgUnitsByPeriodType( unitB.getId(), periodA
 
302
            .getPeriodType() );
 
303
        assertNotNull( "DataBrowserTable not supposed to be null", table );
 
304
        assertNotSame( "No. of queries more than 0", 0, table.getQueryCount() );
 
305
        assertNotSame( "Querytime more than 0", 0, table.getQueryTime() );
 
306
 
 
307
        assertEquals( "Metarows", 3, table.getRows().size() );
 
308
        assertEquals( unitD.getName(), table.getRows().get( 0 ).getName() );
 
309
        assertEquals( unitD.getId(), table.getRows().get( 0 ).getId().intValue() );
 
310
        assertEquals( unitF.getName(), table.getRows().get( 2 ).getName() );
 
311
        assertEquals( unitF.getId(), table.getRows().get( 2 ).getId().intValue() );
 
312
 
 
313
        assertEquals( "Metacolumns", 1 + 2, table.getColumns().size() );
 
314
        assertEquals( periodA.getStartDate().toString(), table.getColumns().get( 1 ).getName() );
 
315
        assertEquals( periodB.getStartDate().toString(), table.getColumns().get( 2 ).getName() );
 
316
 
 
317
        assertEquals( "Row count entries", 3, table.getCounts().size() );
 
318
        assertEquals( "DataValues in unitF for periodB", 2, table.getRowBasedOnRowName( unitF.getName() ).get( 1 )
 
319
            .intValue() );
 
320
 
 
321
    }
 
322
 
 
323
    public void testGetCountDataSetsInPeriod()
 
324
    {
 
325
 
 
326
        DataBrowserTable table = dataBrowserService.getCountDataSetsInPeriod( "2005-02-28", "2005-05-01", periodA
 
327
            .getPeriodType() );
 
328
        assertNotNull( "DataBrowserTable not supposed to be null", table );
 
329
        assertEquals( "No. of queries", 1, table.getQueryCount() );
 
330
        assertNotSame( "Querytime more than 0", 0, table.getQueryTime() );
 
331
 
 
332
        assertEquals( "Metarows", 2, table.getRows().size() );
 
333
        assertEquals( dataSetA.getName(), table.getRows().get( 0 ).getName() );
 
334
        assertEquals( dataSetA.getId(), table.getRows().get( 0 ).getId().intValue() );
 
335
        assertEquals( dataSetB.getName(), table.getRows().get( 1 ).getName() );
 
336
        assertEquals( dataSetB.getId(), table.getRows().get( 1 ).getId().intValue() );
 
337
 
 
338
        assertEquals( "Metacolumns", 2, table.getColumns().size() );
 
339
 
 
340
        assertEquals( "Row count entries", 2, table.getCounts().size() );
 
341
        assertEquals( "DataValues in dataSetA", 12, table.getRowBasedOnRowName( dataSetA.getName() ).get( 0 )
 
342
            .intValue() );
 
343
        assertEquals( "DataValues in dataSetB", 12, table.getRowBasedOnRowName( dataSetB.getName() ).get( 0 )
 
344
            .intValue() );
 
345
    }
 
346
 
 
347
    public void testGetCountDataElementsInPeriod()
 
348
    {
 
349
        DataBrowserTable table = dataBrowserService.getCountDataElementsInPeriod( dataSetA.getId(), "2005-02-28",
 
350
            "2005-05-01", periodA.getPeriodType() );
 
351
        assertNotNull( "DataBrowserTable not supposed to be null", table );
 
352
        assertEquals( "No. of queries", 3, table.getQueryCount() );
 
353
        assertNotSame( "Querytime more than 0", 0, table.getQueryTime() );
 
354
 
 
355
        assertEquals( "Metarows", 1, table.getRows().size() );
 
356
        assertEquals( dataElementA.getName(), table.getRows().get( 0 ).getName() );
 
357
        assertEquals( dataElementA.getId(), table.getRows().get( 0 ).getId().intValue() );
 
358
 
 
359
        assertEquals( "Metacolumns", 1 + 2, table.getColumns().size() );
 
360
 
 
361
        assertEquals( "Row count entries", 1, table.getCounts().size() );
 
362
        assertEquals( "DataValues in periodA", 6, table.getRowBasedOnRowName( dataElementA.getName() ).get( 0 )
 
363
            .intValue() );
 
364
        assertEquals( "DataValues in periodB", 6, table.getRowBasedOnRowName( dataElementA.getName() ).get( 1 )
 
365
            .intValue() );
 
366
    }
 
367
 
 
368
    public void testGetCountOrgUnitsInPeriod()
 
369
    {
 
370
        DataBrowserTable table = dataBrowserService.getCountOrgUnitsInPeriod( unitB.getId(), "2005-02-28",
 
371
            "2005-05-01", periodA.getPeriodType() );
 
372
 
 
373
        assertNotNull( "DataBrowserTable not supposed to be null", table );
 
374
        assertEquals( "No. of queries", 3, table.getQueryCount() );
 
375
        assertNotSame( "Querytime more than 0", 0, table.getQueryTime() );
 
376
 
 
377
        assertEquals( "Metarows", 3, table.getRows().size() );
 
378
        assertEquals( unitD.getName(), table.getRows().get( 0 ).getName() );
 
379
        assertEquals( unitD.getId(), table.getRows().get( 0 ).getId().intValue() );
 
380
        assertEquals( unitF.getName(), table.getRows().get( 2 ).getName() );
 
381
        assertEquals( unitF.getId(), table.getRows().get( 2 ).getId().intValue() );
 
382
 
 
383
        assertEquals( "Metacolumns", 1 + 2, table.getColumns().size() );
 
384
        assertEquals( periodA.getStartDate().toString(), table.getColumns().get( 1 ).getName() );
 
385
        assertEquals( periodB.getStartDate().toString(), table.getColumns().get( 2 ).getName() );
 
386
 
 
387
        assertEquals( "Row count entries", 3, table.getCounts().size() );
 
388
        assertEquals( "DataValues in unitF for periodA", 2, table.getRowBasedOnRowName( unitF.getName() ).get( 0 )
 
389
            .intValue() );
 
390
    }
 
391
}