Skip to content

Commit

Permalink
Migrates olap4j to Mondrian 4.0. This will cause a bunch of failures,…
Browse files Browse the repository at this point in the history
… but we will address them in the coming days.

This commit also modifies the way that Foodmart is deployed for testing. Foodmart data is now an external dependency. Also, we do not use simple-jndi anymore. The database is loaded by MondrianFoodMartLoader and Ant. (See build.xml:init-foodmart)

git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@541 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
lucboudreau committed Aug 1, 2012
1 parent ea07d97 commit 43d0836
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 32 deletions.
67 changes: 49 additions & 18 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,13 @@ src/org/olap4j/driver/xmla/XmlaOlap4jDriverVersion.java" />
</or>
</condition>

<target name="setup" depends="version-properties,compile,create-dot-classpath"
<condition property="init.foodmart">
<not>
<isset property="org.olap4j.foodmartLoader.disabled"/>
</not>
</condition>

<target name="setup" depends="version-properties,compile,create-dot-classpath,init-foodmart"
description="Setups the project for eclipse." />

<target name="hudson" depends="clean-all,clean-tests,version-properties,jar,source.jar,tck-jar,xmla-jar,test,jar-jdk14"
Expand All @@ -99,7 +105,8 @@ src/org/olap4j/driver/xmla/XmlaOlap4jDriverVersion.java" />
<target name="hudson-notest" depends="clean-all,clean-tests,version-properties,jar,source.jar,tck-jar,xmla-jar,jar-jdk14"
description="Sugar goal to build olap4j from hudson." />

<target name="clean" depends="subfloor.clean, clean-generated"/>
<target name="clean" depends="subfloor.clean, clean-generated, clean-foodmart"/>
<target name="clean-all" depends="subfloor.clean-all, clean-generated, clean-foodmart"/>

<target name="clean-generated">
<delete includeemptydirs="true" quiet="true">
Expand Down Expand Up @@ -293,31 +300,55 @@ class XmlaOlap4jDriverVersion {
javacchome="${lib.dir}"/>
</target>

<target name="clean-tests" depends="subfloor.clean-tests">
<antcall target="init-hsql"/>
</target>

<target name="clean-hsql">
<target name="clean-foodmart">
<delete includeemptydirs="false">
<fileset
dir="${basedir}/foodmart"
defaultexcludes="true">
<exclude name="foodmart.zip"/>
<exclude name="FoodMart.xml"/>
<exclude name=".svn"/>
</fileset>
</delete>
</target>

<target name="init-hsql" depends="clean-hsql">
<unzip src="${basedir}/foodmart/foodmart.zip" dest="${basedir}/foodmart/"
overwrite="false" />
</target>

<target name="init-tests" depends="clean-tests">
<mkdir dir="${testclasses.dir}" />
<mkdir dir="${testsrc.dir}" />
<antcall target="init-hsql"/>
</target>
<target name="init-foodmart" if="init.foodmart">
<pathconvert
property="test.classpath.formatted"
pathsep="${line.separator} "
refid="test.classpath" />
<fail message="Missing Foodmart loader driver in test classpath: ${line.separator}${test.classpath.formatted}">
<condition>
<not>
<available classname="${org.olap4j.foodmartLoader.driver}"
classpathref="test.classpath"/>
</not>
</condition>
</fail>
<!-- HSQL SPECIFIC: Always clean first because foodmart
might be created when running the tests before calling
init-foodmart. -->
<antcall target="clean-foodmart"/>
<java classname="mondrian.test.loader.MondrianFoodMartLoader" maxmemory="1024m" fork="true">
<classpath refid="test.classpath"/>
<arg value="-verbose"/>
<arg value="-tables"/>
<arg value="-indexes"/>
<arg value="-data"/>
<arg value="-aggregates"/>
<arg value="-outputJdbcBatchSize=100"/>
<arg value="-dataset=FOODMART"/>
<arg value="-inputFile=jar:file:testlib/mondrian-data-foodmart.jar!/data.sql"/>
<arg value="-afterFile=jar:file:testlib/mondrian-data-foodmart.jar!/after.sql"/>
<arg value="-jdbcDrivers=${org.olap4j.foodmartLoader.driver}"/>
<arg value="-outputJdbcURL=${org.olap4j.foodmartLoader.url}"/>
<arg value="-outputJdbcUser=${org.olap4j.foodmartLoader.user}"/>
<arg value="-outputJdbcPassword=${org.olap4j.foodmartLoader.password}"/>
</java>
<!-- HSQL SPECIFIC: Delete the lock file. -->
<delete file="${basedir}/foodmart/foodmart.lck" failonerror="false"/>
</target>

<target name="init-tests" depends="subfloor.init-tests,init-foodmart"/>

<!-- Override of subfloor to resolve modules artifacts -->
<target name="resolve" depends="install-ivy,install-antcontrib">
Expand Down
Binary file removed foodmart/foodmart.zip
Binary file not shown.
5 changes: 2 additions & 3 deletions ivy-tck.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@

<dependency org="hsqldb" name="hsqldb" rev="1.8.0.7"/>

<dependency org="simple-jndi" name="simple-jndi" rev="0.11.4.1"/>

<dependency org="commons-pool" name="commons-pool" rev="1.1"/>

<dependency org="commons-collections" name="commons-collections" rev="3.2"/>
Expand All @@ -69,9 +67,10 @@
<dependency org="junit" name="junit" rev="3.8.1"/>

<!-- OLAP tests dependencies - uses Mondrian -->
<dependency org="pentaho" name="mondrian" rev="TRUNK-SNAPSHOT" changing="true">
<dependency org="pentaho" name="mondrian" rev="4.0.0-SNAPSHOT" changing="true">
<exclude org="${ivy.artifact.group}" module="${ivy.artifact.id}"/>
</dependency>
<dependency org="pentaho" name="mondrian-data-foodmart" rev="0.9-SNAPSHOT" conf="test->default"/>
</dependencies>
</ivy-module>

Expand Down
1 change: 0 additions & 1 deletion subfloor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ TYPICAL TARGET SEQUENCE
</fileset>
<pathelement location="${classes.dir}" />
<pathelement location="${testclasses.dir}" />
<pathelement location="${org.olap4j.test.driverClasspath}" />
</path>

<!-- Setup the classpath used for javadoc -->
Expand Down
41 changes: 35 additions & 6 deletions test.properties
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@
# It is the default in-process Mondrian tester.
# By default, it will use a file based HSQLDB in the
# /foodmart folder. If you want to test olap4j against
# a different database, edit the jdbc.properties file
# in the /simple-jndi folder.
# a different database, edit 'org.olap4j.test.connectUrl'

org.olap4j.test.helperClassName=mondrian.test.MondrianOlap4jTester
org.olap4j.test.connectUrl=jdbc:mondrian:Datasource=jdbc/SampleData;Catalog=./foodmart/FoodMart.xml;

###############################################################################
# These two lines activate the XMLA tester. Uncomment the two
# lines below to activate it. Make sure you comment out all others.
# lines below to activate it. Make sure you comment out the other
# 'org.olap4j.test.helperClassName' property above.
#
# The in-process XML/A tester is a memory hog. Read the comment above.
#
# By default, it will use a file based HSQLDB in the
# /foodmart folder. If you want to test olap4j against
# a different database, edit the jdbc.properties file
# in the /simple-jndi folder.
# a different database, edit 'org.olap4j.test.connectUrl'

#org.olap4j.test.helperClassName=org.olap4j.XmlaTester
#org.olap4j.XmlaTester.CatalogUrl=file:foodmart/FoodMart.xml
Expand Down Expand Up @@ -81,4 +81,33 @@ org.olap4j.test.connectUrl=jdbc:mondrian:Datasource=jdbc/SampleData;Catalog=./fo
#org.olap4j.test.helperClassName=org.olap4j.RemoteXmlaTester
#org.olap4j.RemoteXmlaTester.JdbcUrl=jdbc:xmla:Server=http://localhost:81/mondrian/xmla;Cache=org.olap4j.driver.xmla.cache.XmlaDatabaseCache;Cache.Init=true;Cache.Record=true

###############################################################################
# This is a URL used to create a Mondrian connection to test against.
# You don't need to touch it, unless you are using the remote xmla
# tester, or if your Foodmart is deployed on another DBMS.
# If you deploy Foodmart in another DBMS and you modify this line,
# you might want to set 'org.olap4j.foodmartLoader.disabled' down below.
org.olap4j.test.connectUrl=jdbc\:mondrian\:Catalog\=./foodmart/FoodMart.xml;;JdbcDriver\=org.hsqldb.jdbcDriver;Jdbc\=jdbc\:hsqldb\:file\:foodmart/foodmart;JdbcUser\=sa;JdbcPassword\=

# This is an example URL for Foodmart deployed in MySQL.
# You will need to add a JAR driver into the 'dev-lib' folder
# for it to work.
#org.olap4j.test.connectUrl=jdbc\:mondrian\:Catalog\=./foodmart/FoodMart.xml;;JdbcDriver\=com.mysql.jdbc.Driver;Jdbc\=jdbc\:mysql\://localhost\:3306/foodmart;JdbcUser\=foodmart;JdbcPassword\=foodmart

###############################################################################
# These properties allow the build script to load FoodMart into
# an HSQLDB database so it can run the tests.
# It only gets executed once, or after invocations of 'clean-all'.
# It is possible to make this script deploy Foodmart in another
# DBMS and run the tests against it, but it needs some hacking.
# You would need to tweak 'org.olap4j.test.connectUrl' and
# disable some checks in build.xml.
org.olap4j.foodmartLoader.driver=org.hsqldb.jdbcDriver
org.olap4j.foodmartLoader.url=jdbc\:hsqldb\:file\:foodmart/foodmart
org.olap4j.foodmartLoader.user=sa
org.olap4j.foodmartLoader.password=
# You can disable the loader altogether by uncommenting this line.
#org.olap4j.foodmartLoader.disabled=true

###############################################################################
# End test.properties
4 changes: 0 additions & 4 deletions testsrc/jndi.properties

This file was deleted.

0 comments on commit 43d0836

Please sign in to comment.