[Mondrian] RE: Eigenbase perforce change 10142 for review

Julian Hyde jhyde at pentaho.org
Sat Nov 3 22:19:02 EDT 2007


Ajit,

The change looks great - but I'd have used a different testing strategy.

With properties which can't readily be changed at runtime, I generally use a
different testing strategy. I don't try to change the property at runtime,
but modify megatest to run the test with the property set both ways.
Sometimes a test has to recuse itself if the property setting is
incompatible with the test, but that's OK. The nice thing is that then all
tests can be run from Main, or indeed standalone.

To see this, change the line in bin/megatest from

  doTest jdk1.6 access

to

  doTest jdk1.6 access mondrian.olap.NullMemberRepresentation=TheNullMember

and you'll get about 10 failures. Can you fix up the suite so it works
whatever the value of the property. You should also be able to back out the
ant changes, such as the junit-nobuild-nomember target.

Julian

> -----Original Message-----
> From: Ajit Joglekar [mailto:ajogleka at thoughtworks.com] 
> Sent: Saturday, November 03, 2007 11:12 AM
> To: Ajit Joglekar; Andreas Voss; Bart Pappyn; Julian Hyde; 
> John V. Sichi; Matt Campbell; Robin Tharappel; Sam Birney; 
> Will Gorman; Zelaine Fong
> Subject: Eigenbase perforce change 10142 for review
> 
> http://p4web.eigenbase.org/@md=d&c=6PU@//10142?ac=10
> 
> Change 10142 by ajogleka at AJITNEW on 2007/11/03 10:11:27
> 
> 	MONDRIAN: New "mondrian.olap.NullMemberRepresentation" 
> parameter in Mondrian.properties to take place of the 
> hardcoded RolapUtil.mdxNullLiteral variable that is currently 
> set to "#null"
> 
> Affected files ...
> 
> ... //open/mondrian/build.xml#168 edit
> ... //open/mondrian/doc/configuration.html#35 edit
> ... 
> //open/mondrian/src/main/mondrian/olap/MondrianProperties.java#84 edit
> ... 
> //open/mondrian/src/main/mondrian/rolap/RolapHierarchy.java#70 edit
> ... //open/mondrian/src/main/mondrian/rolap/RolapMember.java#66 edit
> ... //open/mondrian/src/main/mondrian/rolap/RolapUtil.java#52 edit
> ... 
> //open/mondrian/testsrc/main/mondrian/olap/BaseNullMemberRepre
> sentationTest.java#1 add
> ... 
> //open/mondrian/testsrc/main/mondrian/olap/NullMemberCustomRep
> resentationTest.java#1 add
> ... 
> //open/mondrian/testsrc/main/mondrian/olap/NullMemberEmptyRepr
> esentationTest.java#1 add
> ... 
> //open/mondrian/testsrc/main/mondrian/olap/fun/FunctionTest.ja
> va#104 edit
> 
> Differences ...
> 
> ==== //open/mondrian/build.xml#168 (ktext) ====
> 
> 2c2
> <   == $Id: //open/mondrian/build.xml#167 $
> ---
> >   == $Id: //open/mondrian/build.xml#168 $
> 483a484
> >     <antcall target="junit-nobuild-nullmember"/>
> 549a551,552
> >     <antcall target="junit-nobuild-nullmember"/>
> > 
> 600a604,652
> >   <target name="junit-nullmember"
> >       description="Runs all Null Member JUnit tests."
> >       
> depends="compile,compile.tests,unzip-databases,set.connectString">
> >     <antcall target="junit-nobuild-nullmember"/>
> >   </target>
> > 
> >   <!--
> >     Each test runs in a forked jvm to overcome limitations 
> due to static
> >     variable initializatoin. Can't add to Main
> >   -->
> >   <target name="junit-nobuild-nullmember">
> >     <junit printsummary="yes" fork="yes" forkmode="perTest" 
> haltonfailure="no"
> >            haltonerror="no" errorproperty="juniterror"
> >            failureproperty="junitfailure" showoutput="yes">
> >         <classpath>
> >             <path refid="project.test.classpath"/>
> >         </classpath>
> >         <sysproperty key="log4j.configuration"
> >           value="${log4j.configuration}"/>
> >         <sysproperty key="mondrian.jdbcDrivers"
> >             value="${mondrian.jdbcDrivers}"/>
> >         <sysproperty key="mondrian.test.connectString"
> >             value="${mondrian.test.connectString}"/>
> >         <sysproperty key="mondrian.test.foodmart.catalogURL"
> >             value="${mondrian.foodmart.catalogURL}"/>
> >         <formatter type="xml" />
> >         <batchtest fork="yes">
> >             <fileset dir="${testclasses.dir}">
> >               <include 
> name="mondrian/olap/NullMemberCustomRepresentationTest.class" />
> >             </fileset>
> >         </batchtest>
> >         <batchtest fork="yes">
> >             <fileset dir="${testclasses.dir}">
> >               <include 
> name="mondrian/olap/NullMemberEmptyRepresentationTest.class" />
> >             </fileset>
> >         </batchtest>
> >     </junit>
> >     <fail>
> >         <condition>
> >             <isset property="juniterror"/>
> >         </condition>
> >     </fail>
> >     <fail>
> >         <condition>
> >             <isset property="junitfailure"/>
> >         </condition>
> >     </fail>
> >   </target>
> > 
> 
> ==== //open/mondrian/doc/configuration.html#35 (ktext) ====
> 
> 3c3
> <   == $Id: //open/mondrian/doc/configuration.html#34 $
> ---
> >   == $Id: //open/mondrian/doc/configuration.html#35 $
> 333a334,340
> >       <td><code><a 
> href="api/mondrian/olap/MondrianProperties.html#NullMemberRepr
> esentation">mondrian.olap.NullMemberRepresentation</a></code></td>
> >       <td>string</td>
> >       <td>#null</td>
> >       <td>Defines how a null Member is represented in the 
> result output.
> >       MSAS 2000 shows empty value while MSAS 2005 shows 
> "(null)"</td>
> >     </tr>
> >     <tr>
> 1297c1304
> <     Version: $Id: //open/mondrian/doc/configuration.html#34 $
> ---
> >     Version: $Id: //open/mondrian/doc/configuration.html#35 $
> 
> ==== 
> //open/mondrian/src/main/mondrian/olap/MondrianProperties.java
> #84 (ktext) ====
> 
> 2c2
> < // $Id: 
> //open/mondrian/src/main/mondrian/olap/MondrianProperties.java#83 $
> ---
> > // $Id: 
> //open/mondrian/src/main/mondrian/olap/MondrianProperties.java#84 $
> 57c57
> <  * @version $Id: 
> //open/mondrian/src/main/mondrian/olap/MondrianProperties.java#83 $
> ---
> >  * @version $Id: 
> //open/mondrian/src/main/mondrian/olap/MondrianProperties.java#84 $
> 943a944,953
> >      * Property which determines how a null member value is 
> represented in the
> >      * result output.
> >      * <p>AS 2000 shows this as empty value
> >      * <p>AS 2005 shows this as "(null)" value
> >      */
> >     public transient final StringProperty NullMemberRepresentation =
> >             new StringProperty(this, 
> "mondrian.olap.NullMemberRepresentation",
> >                     "#null");
> > 
> >     /**
> 
> ==== 
> //open/mondrian/src/main/mondrian/rolap/RolapHierarchy.java#70
>  (ktext) ====
> 
> 2c2
> < // $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapHierarchy.java#69 $
> ---
> > // $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapHierarchy.java#70 $
> 37c37
> <  * @version $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapHierarchy.java#69 $
> ---
> >  * @version $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapHierarchy.java#70 $
> 955c955
> <             super(null, level, null, "#Null", MemberType.NULL);
> ---
> >             super(null, level, null, 
> RolapUtil.mdxNullLiteral, MemberType.NULL);
> 
> ==== 
> //open/mondrian/src/main/mondrian/rolap/RolapMember.java#66 
> (ktext) ====
> 
> 2c2
> < // $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapMember.java#65 $
> ---
> > // $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapMember.java#66 $
> 27c27
> <  * @version $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapMember.java#65 $
> ---
> >  * @version $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapMember.java#66 $
> 266c266
> <         if (key == null) {
> ---
> >         if (key == null || RolapUtil.sqlNullValue.equals(key)) {
> 
> ==== 
> //open/mondrian/src/main/mondrian/rolap/RolapUtil.java#52 (ktext) ====
> 
> 2c2
> < // $Id: //open/mondrian/src/main/mondrian/rolap/RolapUtil.java#51 $
> ---
> > // $Id: //open/mondrian/src/main/mondrian/rolap/RolapUtil.java#52 $
> 35c35
> <  * @version $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapUtil.java#51 $
> ---
> >  * @version $Id: 
> //open/mondrian/src/main/mondrian/rolap/RolapUtil.java#52 $
> 76c76,81
> <     public static final String mdxNullLiteral = "#null";
> ---
> >     /**
> >      * Runtime NullMemberRepresentation property change not 
> taken into
> >      * consideration
> >      */
> >     public static final String mdxNullLiteral =
> >             
> MondrianProperties.instance().NullMemberRepresentation.get();
> 
> ==== 
> //open/mondrian/testsrc/main/mondrian/olap/fun/FunctionTest.ja
> va#104 (ktext) ====
> 
> 2c2
> < // $Id: 
> //open/mondrian/testsrc/main/mondrian/olap/fun/FunctionTest.java#103 $
> ---
> > // $Id: 
> //open/mondrian/testsrc/main/mondrian/olap/fun/FunctionTest.java#104 $
> 20a21
> > import mondrian.rolap.RolapUtil;
> 27a29
> > import java.util.Properties;
> 34c36
> <  * @version $Id: 
> //open/mondrian/testsrc/main/mondrian/olap/fun/FunctionTest.java#103 $
> ---
> >  * @version $Id: 
> //open/mondrian/testsrc/main/mondrian/olap/fun/FunctionTest.java#104 $
> 187c189
> <                 "[Gender].[#Null]");
> ---
> >                 "[Gender].[#null]");
> 191c193
> <                 "#Null");
> ---
> >                 "#null");
> 804c806
> <                         "Row #2: [Time].[#Null]\n" + // 
> MSAS returns "" here.
> ---
> >                         "Row #2: [Time].[#null]\n" + // 
> MSAS returns "" here.
> 3591c3593
> <         assertExprReturns("[Store].Parent.Name", "#Null");
> ---
> >         assertExprReturns("[Store].Parent.Name", "#null");
> 3615c3617,3618
> <         assertExprReturns("[Measures].[Unit 
> Sales].FirstChild.UniqueName", "[Measures].[#Null]"); // 
> MSOLAP gives "" here
> ---
> >         assertExprReturns("[Measures].[Unit 
> Sales].FirstChild.UniqueName",
> >                 "[Measures].[#null]"); // MSOLAP gives "" here
> 3938c3941
> <                 "#Null");
> ---
> >                 "#null");
> 3980c3983
> <                 "#Null");
> ---
> >                 "#null");
> 3983c3986
> <                 "#Null");
> ---
> >                 "#null");
> 4358c4361
> <                     "Row #0: [Time].[#Null]\n"));
> ---
> >                     "Row #0: [Time].[#null]\n"));
> 4400c4403
> <                     "Row #0: [Time].[#Null]\n"));
> ---
> >                     "Row #0: [Time].[#null]\n"));
> 6036,6037c6039,6040
> <         
> assertExprReturns("[Time].[1997].Children.Item(6).UniqueName",
>  "[Time].[#Null]");
> <         
> assertExprReturns("[Time].[1997].Children.Item(-1).UniqueName"
> , "[Time].[#Null]");
> ---
> >         
> assertExprReturns("[Time].[1997].Children.Item(6).UniqueName",
>  "[Time].[#null]");
> >         
> assertExprReturns("[Time].[1997].Children.Item(-1).UniqueName"
> , "[Time].[#null]");
> 




More information about the Mondrian mailing list