[Mondrian] Running the JUnit tests
Patrick Leckey
patl at seewind.com
Fri Mar 23 15:01:29 EDT 2012
I, of course, had my table layout backwards. D'oh.
Test is now working (and better yet, passing!).
Thanks!
Pat
On 2012-03-23, at 11:40 AM, Patrick Leckey wrote:
> Ok, playing with the CsvDBTestCase stuff … pretty cool …
>
> I'm still getting the "no table found in hierarchy" error, though.
>
> My CSV file (which is definitely being read, if I muck it up I get exceptions):
>
> # non_pkey_closure_test
> ## TableName: non_pkey_closure_test
> ## ColumnNames: store_id,employee_id,supervisor_id,full_name,manager_rank
> ## ColumnTypes: INTEGER,INTEGER,INTEGER,VARCHAR(30),INTEGER
> ## NosOfRows: 4
> 1,11,5,"Jonathan Murraiin",1
> 2,29,22,"Kevin Armstrong",2
> 3,30,22,"Cody Goldey",3
> 4,15,5,"Walter Cavestany",4
>
> My cube def:
>
> protected String getCubeDescription() {
> return
> "<Cube name=\"ClosureTest\">\n"
> + " <Table name=\"non_pkey_closure_test\"/>\n"
> + " \n"
> + " <Dimension name=\"Store Managers\" foreignKey=\"store_id\">\n"
> + " <Hierarchy hasAll=\"true\" allMemberName=\"All Managers\"\n"
> + " primaryKey=\"store_id\" primaryKeyTable=\"non_pkey_closure_test\"\n"
> + " name=\"Manager\">\n"
> + " <Table name=\"employee\"/>\n"
> + " <Level name=\"Employee Id\" type=\"Numeric\" uniqueMembers=\"true\"\n"
> + " column=\"employee_id\" parentColumn=\"supervisor_id\"\n"
> + " nameColumn=\"full_name\" nullParentValue=\"0\">\n"
> + " <Closure parentColumn=\"supervisor_id\" childColumn=\"employee_id\">\n"
> + " <Table name=\"employee_closure\"/>\n"
> + " </Closure>\n"
> + " </Level>\n"
> + " </Hierarchy>\n"
> + " </Dimension>\n"
> + " \n"
> + " <Measure name=\"Rank\" column=\"manager_rank\" aggregator=\"min\" formatString=\"Standard\"/>\n"
> + "</Cube>\n";
> }
>
> Error message:
>
> testNonPrimaryKeyClosure(mondrian.test.NonPrimaryKeyClosureTest)mondrian.olap.MondrianException: Mondrian Error:Internal error: no table 'non_pkey_closure_test' found in hierarchy [Store Managers.Manager]
> …
> at mondrian.rolap.HierarchyUsage.findJoinTable(HierarchyUsage.java:429)
>
> So the exception still seems to be coming from the same spot as before, too.
>
> Thanks,
> Pat
>
> On 2012-03-22, at 9:47 AM, Patrick Leckey wrote:
>
>> Haven't tried CsvDBTestCase yet, was hoping it was something I was doing wrong with inline tables. :) I'll give it a shot today.
>>
>> Thanks,
>> Pat
>>
>> On 2012-03-21, at 8:24 PM, Julian Hyde wrote:
>>
>>> There are a few places where an InlineTable cannot be used in place of a regular table. (Not that it shouldn't -- but it's never been implemented.) I can well believe that this is one of those.
>>>
>>> Sorry! I know it would have made it easier to write the test. InlineTable support will be better in mondrian-4, by the way.
>>>
>>> Did you try extending CsvDBTestCase? That allows you to create a table at the start of the test, and drop it at the end.
>>>
>>> Julian
>>>
>>> On Mar 21, 2012, at 1:30 PM, Patrick Leckey wrote:
>>>
>>>> Julian,
>>>>
>>>> I am working with TestContext.create() as you suggested, and am trying to accomplish this with an inline table (since I need data not in the FoodMart SQL). It looks promising, but I the test is failing with the following error:
>>>>
>>>> Mondrian Error:Internal error: no table 'store_management' found in hierarchy [Store Managers.Manager]
>>>>
>>>> Which seems to be failing in HierarchyUsage.findJoinTable() (specifically the exception thrown at line 429). Are inline tables not able to be used this way?
>>>>
>>>> I have defined the cube I am adding with TestContext.create() as follows:
>>>>
>>>> <Cube name="ClosureTest">
>>>> <InlineTable alias="store_management">
>>>> <ColumnDefs>
>>>> <ColumnDef name="store_id" type="Numeric"/>
>>>> <ColumnDef name="employee_id" type="Numeric"/>
>>>> <ColumnDef name="supervisor_id" type="Numeric"/>
>>>> <ColumnDef name="manager_rank" type="Numeric"/>
>>>> </ColumnDefs>
>>>> <Rows>
>>>> <Row>
>>>> <Value column="store_id">2</Value>
>>>> <Value column="employee_id">29</Value>
>>>> <Value column="supervisor_id">22</Value>
>>>> <Value column="manager_rank">1</Value>
>>>> </Row>
>>>> <Row>
>>>> <Value column="store_id">3</Value>
>>>> <Value column="employee_id">30</Value>
>>>> <Value column="supervisor_id">22</Value>
>>>> <Value column="manager_rank">2</Value>
>>>> </Row>
>>>> <Row>
>>>> <Value column="store_id">4</Value>
>>>> <Value column="employee_id">15</Value>
>>>> <Value column="supervisor_id">5</Value>
>>>> <Value column="manager_rank">3</Value>
>>>> </Row>
>>>> <Row>
>>>> <Value column="store_id">5</Value>
>>>> <Value column="employee_id">12</Value>
>>>> <Value column="supervisor_id">5</Value>
>>>> <Value column="manager_rank">4</Value>
>>>> </Row>
>>>> </Rows>
>>>> </InlineTable>
>>>>
>>>> <Dimension name="Store Managers" foreignKey="store_id">
>>>> <Hierarchy hasAll="true" allMemberName="All Managers"
>>>> primaryKey="store_id" primaryKeyTable="store_management"
>>>> name="Manager">
>>>> <Table name="employee"/>
>>>> <Level name="Employee Id" type="Numeric" uniqueMembers="true"
>>>> column="employee_id" parentColumn="supervisor_id"
>>>> nameColumn="full_name" nullParentValue="0">
>>>> <Closure parentColumn="supervisor_id" childColumn="employee_id">
>>>> <Table name="employee_closure"/>
>>>> </Closure>
>>>> </Level>
>>>> </Hierarchy>
>>>> </Dimension>
>>>>
>>>> <Measure name="Rank" column="manager_rank" aggregator="min" formatString="Standard"/>
>>>> </Cube>
>>>>
>>>> _______________________________________________
>>>> Mondrian mailing list
>>>> Mondrian at pentaho.org
>>>> http://lists.pentaho.org/mailman/listinfo/mondrian
>>>
>>> _______________________________________________
>>> Mondrian mailing list
>>> Mondrian at pentaho.org
>>> http://lists.pentaho.org/mailman/listinfo/mondrian
>>
>> _______________________________________________
>> Mondrian mailing list
>> Mondrian at pentaho.org
>> http://lists.pentaho.org/mailman/listinfo/mondrian
>
> _______________________________________________
> Mondrian mailing list
> Mondrian at pentaho.org
> http://lists.pentaho.org/mailman/listinfo/mondrian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20120323/2de424a5/attachment.html
More information about the Mondrian
mailing list