Hibernate SVN: r15025 - in annotations/trunk: doc/reference and 12 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-08-11 05:14:39 -0400 (Mon, 11 Aug 2008)
New Revision: 15025
Added:
annotations/trunk/lib/build/ant-contrib-1.0b2.jar
annotations/trunk/src/filters/
annotations/trunk/src/filters/db2.filter
annotations/trunk/src/filters/derby.filter
annotations/trunk/src/filters/hsqldb.filter
annotations/trunk/src/filters/mckoi.filter
annotations/trunk/src/filters/mssql.filter
annotations/trunk/src/filters/mysql.filter
annotations/trunk/src/filters/oracle.filter
annotations/trunk/src/filters/postgresql.filter
annotations/trunk/src/filters/sybase.filter
annotations/trunk/src/test-resources/
annotations/trunk/src/test-resources/ehcache.xml
annotations/trunk/src/test-resources/hibernate.properties
annotations/trunk/src/test-resources/log4j.properties
annotations/trunk/src/test/org/hibernate/test/annotations/RequiresDialect.java
Removed:
annotations/trunk/src/test/ehcache.xml
annotations/trunk/src/test/hibernate.properties
annotations/trunk/src/test/log4j.properties
Modified:
annotations/trunk/build.xml
annotations/trunk/common-build.xml
annotations/trunk/doc/reference/build.xml
annotations/trunk/src/test/org/hibernate/test/annotations/EntityTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/TestCase.java
annotations/trunk/src/test/org/hibernate/test/annotations/access/AccessTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/id/IdTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/join/JoinTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
annotations/trunk/src/test/org/hibernate/test/annotations/onetomany/OneToManyTest.java
Log:
* Refactored the build files and updated common-build.xml. Also introduced the new ant extension ant-contrib.
* Now the build can run against multiple databases using filters.
* Also introduced a new test annotation @RequiresDialect to mark a single test or whole testclass specific for a given Dialect. We probably will need also @SkipForDialect. That will come at a later stage.
Tests are passing now for hsqldb and mysql. More databases need to be tested.
Modified: annotations/trunk/build.xml
===================================================================
--- annotations/trunk/build.xml 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/build.xml 2008-08-11 09:14:39 UTC (rev 15025)
@@ -7,13 +7,13 @@
-->
<project name="Hibernate Annotations" default="dist" basedir="."
- xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
-
- <!-- Give user a chance to override without editing this file
- (and without typing -D each time it compiles it) -->
+ xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+
+ <!-- Give user a chance to override without editing this file
+ (and without typing -D each time it compiles it) -->
<property file="build.properties"/>
<property file="${user.home}/.ant.properties"/>
-
+
<!-- Name of project and version, used to create filenames -->
<property name="Name" value="Hibernate Annotations"/>
<property name="name" value="hibernate-annotations"/>
@@ -21,86 +21,59 @@
<property name="javadoc.packagenames" value="org.hibernate.*"/>
<property name="jdbc.dir" value="jdbc"/>
<property name="copy.test" value="true"/>
- <property name="javac.source" value="1.5"/>
- <property name="javac.target" value="1.5"/>
- <property name="common.dir" value="${basedir}"/>
-
- <!-- property name="jpa-api.jar" value="${basedir}/../jpa-api/build/ejb3-persistence.jar"/>
- <property name="commons-annotations.jar"
- value="${basedir}/../commons-annotations/target/hibernate-commons-annotations/hibernate-commons-annotations.jar"/ -->
- <property name="ivy.dep.dir" value="${basedir}/build/lib" />
-
-
- <available property="jpa-present" file="${basedir}/../jpa-api" type="dir"/>
+ <property name="javac.source" value="1.5"/>
+ <property name="javac.target" value="1.5"/>
+ <property name="common.dir" value="${basedir}"/>
+ <property name="ivy.dep.dir" value="${basedir}/build/lib"/>
+
+ <available property="jpa-present" file="${basedir}/../jpa-api" type="dir"/>
+ <property name="jpa-javadoc.dir" value="${dist.doc.dir}/jpa-api"/>
+
<import file="${common.dir}/common-build.xml"/>
- <property name="jpa-javadoc.dir" value="${dist.doc.dir}/jpa-api"/>
-
-
- <path id="lib.moduleclass.path">
- <!-- pathelement location="${jpa-api.jar}"/>
- <pathelement location="${commons-annotations.jar}"/ -->
- <fileset dir="${ivy.dep.dir}/core">
+
+ <path id="lib.moduleclass.path">
+ <fileset dir="${ivy.dep.dir}/core">
<include name="*.jar"/>
</fileset>
- </path>
-
+ <fileset dir="${common-build.basedir}/lib/build">
+ <!-- ${build.lib.dir} fails in reference doc build -->
+ <include name="junitext-*.jar"/>
+ </fileset>
+ </path>
+
<path id="junit.moduleclasspath">
<pathelement location="${src.dir}"/>
<pathelement location="${test.dir}"/>
- <pathelement location="lib/testlibs/org.eclipse.jdt.core_3.1.0.jar"/>
<fileset dir="${jdbc.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
- <fileset dir="${ivy.dep.dir}/test">
+ <fileset dir="${ivy.dep.dir}/test">
<include name="*.jar"/>
</fileset>
- </path>
-
- <target name="init">
+ </path>
+
+ <target name="init">
<antcall target="common-build.init"/>
- <tstamp>
- <format property="now" pattern="yyyyMMddhhmmss"/>
- </tstamp>
- <!-- available file="${jpa-api.jar}" type="file" property="jpa-api.jar.available"/>
- <available file="${commons-annotations.jar}" type="file" property="commons-annotations.jar.available"/ -->
- <mkdir dir="${ivy.dep.dir}/core"/>
- <mkdir dir="${ivy.dep.dir}/test"/>
- <ivy:configure file="${ivy.jar.dir}/ivyconf.xml" />
- </target>
-
- <!-- target name="get.jpa-api" depends="init" unless="jpa-api.jar.available">
- <ant inheritall="false" dir="${basedir}/../jpa-api" target="clean"/>
- <ant inheritall="false" dir="${basedir}/../jpa-api" target="jar"/>
+ <tstamp>
+ <format property="now" pattern="yyyyMMddhhmmss"/>
+ </tstamp>
+ <mkdir dir="${ivy.dep.dir}/core"/>
+ <mkdir dir="${ivy.dep.dir}/test"/>
+ <ivy:configure file="${ivy.jar.dir}/ivyconf.xml"/>
</target>
-
- <target name="get.commons-annotations" depends="init" unless="commons-annotations.jar.available">
- <ant inheritall="false" dir="${basedir}/../commons-annotations" target="clean"/>
- <ant inheritall="false" dir="${basedir}/../commons-annotations" target="jar"/>
- </target -->
-
- <target name="get.deps.core" depends="init" description="retrieve the core dependencies">
- <ivy:resolve conf="default" />
- <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]" conf="default" />
- </target>
-
- <target name="compile" depends="init,get.deps.core"
- description="Compile the Java source code">
-
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- srcdir="${src.dir}"
- destdir="${classes.dir}"
- classpathref="lib.class.path"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on"
- source="${javac.source}"
- target="${javac.target}">
+
+ <target name="compile" depends="init,get.deps.core"
+ description="Compile the Java source code">
+
+ <available classname="org.eclipse.core.launcher.Main"
+ property="build.compiler"
+ value="org.eclipse.jdt.core.JDTCompilerAdapter"
+ classpath="${java.class.path}"/>
+ <javac srcdir="${src.dir}" destdir="${classes.dir}"
+ classpathref="lib.class.path" debug="${javac.debug}"
+ optimize="${javac.optimize}" nowarn="on" source="${javac.source}"
+ target="${javac.target}">
<src path="${src.dir}"/>
</javac>
<copy todir="${classes.dir}">
@@ -110,53 +83,85 @@
</fileset>
</copy>
</target>
-
- <target name="get.deps.test" depends="init" description="retrieve the test dependencies">
- <ivy:resolve conf="test" />
- <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test" />
- </target>
-
- <target name="compiletest" depends="compile,get.deps.test" description="Compile the tests">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- destdir="${testclasses.dir}"
- classpathref="junit.classpath"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on"
- source="${javac.source}"
- target="${javac.target}">
+
+ <target name="compiletest" depends="compile,get.deps.test"
+ description="Compile the tests">
+ <available classname="org.eclipse.core.launcher.Main"
+ property="build.compiler"
+ value="org.eclipse.jdt.core.JDTCompilerAdapter"
+ classpath="${java.class.path}"/>
+ <javac destdir="${testclasses.dir}" classpathref="junit.classpath"
+ debug="${javac.debug}" optimize="${javac.optimize}" nowarn="on"
+ source="${javac.source}" target="${javac.target}">
<src refid="testsrc.path"/>
</javac>
</target>
-
- <target name="jar" depends="compile" description="Build the distribution .jar file">
+
+ <target name="jar" depends="compile"
+ description="Build the distribution .jar file">
<mkdir dir="${classes.dir}/META-INF"/>
<manifest file="${classes.dir}/META-INF/MANIFEST.MF">
<attribute name="Implementation-Title" value="${Name}"/>
<attribute name="Implementation-Version" value="${version}"/>
- <attribute name="Implementation-Vendor" value="hibernate.org"/>
- <attribute name="Implementation-Vendor-Id" value="hibernate.org"/>
- <attribute name="Implementation-URL" value="http://annotations.hibernate.org"/>
- <attribute name="Specification-Title" value="Java Persistence"/>
+ <attribute name="Implementation-Vendor" value="hibernate.org"/>
+ <attribute name="Implementation-Vendor-Id" value="hibernate.org"/>
+ <attribute name="Implementation-URL"
+ value="http://annotations.hibernate.org"/>
+ <attribute name="Specification-Title" value="Java Persistence"/>
<attribute name="Specification-Version" value="1.0"/>
- <attribute name="Specification-Vendor" value="jcp.org"/>
- </manifest>
+ <attribute name="Specification-Vendor" value="jcp.org"/>
+ </manifest>
<antcall target="common-build.jar"/>
- <delete file="${dist.dir}/ivy.xml"/> <!-- delete last produced ivy file to be sure a new one will be generated -->
- <ivy:resolve conf="default"/>
- <ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]"
- resolver="local"
- pubrevision="latest"
- pubdate="${now}"
- status="integration"
- />
- </target>
-
+ <delete file="${dist.dir}/ivy.xml"/>
+ <!-- delete last produced ivy file to be sure a new one will be generated -->
+ <ivy:resolve conf="default"/>
+ <ivy:publish artifactspattern="${dist.dir}/[artifact].[ext]"
+ resolver="local" pubrevision="latest" pubdate="${now}"
+ status="integration"/>
+ </target>
+
+ <target name="junit" depends="compiletest">
+ <for list="${targetdb}" param="db">
+ <sequential>
+ <antcall target="test-resources">
+ <param name="db" value="@{db}"/>
+ </antcall>
+ <mkdir dir="${testreports.dir}/@{db}"/>
+ <echo>Running against db: @{db}</echo>
+ <junit printsummary="yes" haltonfailure="yes" forkmode="once">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest fork="yes" todir="${testreports.dir}/@{db}"
+ haltonfailure="no">
+ <fileset refid="junit.batchtestset"/>
+ </batchtest>
+ </junit>
+ </sequential>
+ </for>
+ </target>
+
+ <!-- Run a single unit test. -->
+ <target name="junitsingle" depends="compiletest"
+ description="Run a single test suite (requires testname and jdbc.driver properties)">
+ <for list="${targetdb}" param="db">
+ <sequential>
+ <antcall target="test-resources">
+ <param name="db" value="@{db}"/>
+ </antcall>
+ <mkdir dir="${testreports.dir}/@{db}"/>
+ <echo>Running against db: @{db}</echo>
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <test fork="yes" todir="${testreports.dir}/@{db}"
+ haltonfailure="no" name="${testname}"/>
+ </junit>
+ </sequential>
+ </for>
+ </target>
+
<target name="jpa-javadoc" if="jpa-present">
<mkdir dir="${jpa-javadoc.dir}"/>
<ant dir="../jpa-api" target="javadoc" inheritAll="false"/>
@@ -166,51 +171,55 @@
</fileset>
</copy>
</target>
-
+
<!-- Some of this can probably be moved to common-build... -->
- <target name="dist" depends="get.deps.core,get.deps.test,jar,javadoc,jpa-javadoc,copysource,copytest,copylib,extras"
- description="Build everything">
-
+ <target name="dist"
+ depends="get.deps.core,get.deps.test,jar,javadoc,jpa-javadoc,copysource,copytest,copylib,extras"
+ description="Build everything">
+
<ant inheritall="false" dir="${basedir}/doc/reference"/>
<copy todir="${dist.dir}/doc/reference" failonerror="false">
<fileset dir="${basedir}/doc/reference/build">
<include name="**/*.*"/>
</fileset>
</copy>
-
+
<copy todir="${dist.dir}" failonerror="false">
<fileset dir="${common.dir}">
<include name="common-build.xml"/>
</fileset>
</copy>
- <copy todir="${dist.dir}/ivy" failonerror="false">
- <fileset dir="${ivy.jar.dir}">
- <include name="**/*.*"/>
- </fileset>
- </copy>
-
- <!-- copy dependencies -->
- <copy todir="${dist.lib.dir}" failonerror="false">
+ <copy todir="${dist.dir}/ivy" failonerror="false">
+ <fileset dir="${ivy.jar.dir}">
+ <include name="**/*.*"/>
+ </fileset>
+ </copy>
+
+ <!-- copy dependencies -->
+ <copy todir="${dist.lib.dir}" failonerror="false">
<fileset dir="${ivy.dep.dir}/core">
- <include name="*.jar"/>
- </fileset>
- </copy>
- <mkdir dir="${dist.lib.dir}/test"/>
- <copy todir="${dist.lib.dir}/test" failonerror="false">
+ <include name="*.jar"/>
+ </fileset>
+ </copy>
+ <mkdir dir="${dist.lib.dir}/test"/>
+ <copy todir="${dist.lib.dir}/test" failonerror="false">
<fileset dir="${ivy.dep.dir}/test">
- <include name="*.jar"/>
- </fileset>
- </copy>
-
- <!-- ivy uses the module name without hibernate- (to mimic the directory names). Revert the situation -->
- <move file="${dist.lib.dir}/commons-annotations.jar" tofile="${dist.lib.dir}/hibernate-commons-annotations.jar"
- failonerror="false"/>
-
- <copy file="${basedir}/build.properties.dist" tofile="${dist.dir}/build.properties" failonerror="false">
+ <include name="*.jar"/>
+ </fileset>
</copy>
+
+
+ <!-- ivy uses the module name without hibernate- (to mimic the directory names). Revert the situation -->
+ <move file="${dist.lib.dir}/commons-annotations.jar"
+ tofile="${dist.lib.dir}/hibernate-commons-annotations.jar"
+ failonerror="false"/>
+
+ <copy file="${basedir}/build.properties.dist"
+ tofile="${dist.dir}/build.properties" failonerror="false">
+ </copy>
<antcall target="common-build.dist"/>
</target>
-
+
<target name="zip-dist" description="zip the dist">
<zip zipfile="${dist.dir}-${version}.zip">
<zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
@@ -219,5 +228,5 @@
<tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
</tar>
</target>
-
+
</project>
Modified: annotations/trunk/common-build.xml
===================================================================
--- annotations/trunk/common-build.xml 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/common-build.xml 2008-08-11 09:14:39 UTC (rev 15025)
@@ -1,277 +1,248 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project name="common-build" default="dist"
- xmlns:artifact="urn:maven-artifact-ant">
- <description>Common properties and targets for the HibernateExt project</description>
-
- <!-- my.basedir property can be used to refer to files/directories relatively to the common-build.xml file -->
- <dirname property="common-build.basedir" file="${ant.file.common-build}"/>
-
- <!-- Give user a chance to override without editing this file
- (and without typing -D each time it compiles it) -->
- <property file="${common-build.basedir}/build.properties"/>
- <property file="${user.home}/.ant.properties"/>
-
- <property name="src.dir" location="src/java"/>
- <property name="test.dir" location="src/test"/>
- <property name="lib.dir" location="lib"/>
- <property name="build.dir" location="build"/>
- <property name="classes.dir" location="${build.dir}/classes"/>
- <property name="testclasses.dir" location="${build.dir}/testclasses"/>
- <property name="testreports.dir" location="${build.dir}/test-reports"/>
- <property name="dist.target.dir" location="target"/>
- <property name="dist.dir" location="${dist.target.dir}/${name}"/>
- <property name="instrumenttest.out.dir" value="instrumenttestout"/>
- <property name="doc.dir" location="doc"/>
- <property name="doc.api.dir" location="${doc.dir}/api"/>
- <property name="doc.reference.dir" location="${doc.dir}/reference"/>
-
- <property name="dist.doc.dir" location="${dist.dir}/doc"/>
- <property name="dist.api.dir" location="${dist.dir}/doc/api"/>
-
- <property name="dist.src.dir" location="${dist.dir}/src"/>
- <property name="dist.test.dir" location="${dist.dir}/test"/>
- <property name="dist.lib.dir" location="${dist.dir}/lib"/>
- <property name="jar.name" value="${name}"/>
- <property name="jar.file.name" value="${dist.dir}/${jar.name}.jar"/>
- <property name="jartest.file.name" value="${dist.dir}/${jar.name}-tests.jar"/>
-
- <property name="javadoc" value="http://java.sun.com/j2se/1.4/docs/api"/>
- <property name="javac.debug" value="on"/>
- <property name="javac.optimize" value="off"/>
- <property name="javac.source" value="1.4"/>
- <property name="javac.target" value="1.4"/>
-
- <property name="pom.file" value="pom.xml"/>
- <property name="src.jar" value="${build.dir}/src.jar"/>
-
+<project name="common-build" default="dist"
+ xmlns:artifact="urn:maven-artifact-ant" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+ <description>Common properties and targets for the HibernateExt
+ project</description>
+
+
+ <!-- my.basedir property can be used to refer to files/directories relatively to the common-build.xml file -->
+ <dirname property="common-build.basedir" file="${ant.file.common-build}"/>
+
+ <!-- Give user a chance to override without editing this file
+ (and without typing -D each time it compiles it) -->
+ <property file="${common-build.basedir}/build.properties"/>
+ <property file="${user.home}/.ant.properties"/>
+
+ <property name="src.dir" location="src/java"/>
+ <property name="test.dir" location="src/test"/>
+ <property name="test.resources.dir" location="src/test-resources"/>
+ <property name="filter.dir" location="src/filters"/>
+ <property name="lib.dir" location="lib"/>
+ <property name="build.dir" location="build"/>
+ <property name="classes.dir" location="${build.dir}/classes"/>
+ <property name="testclasses.dir" location="${build.dir}/testclasses"/>
+ <property name="testreports.dir" location="${build.dir}/test-reports"/>
+ <property name="dist.target.dir" location="target"/>
+ <property name="dist.dir" location="${dist.target.dir}/${name}"/>
+ <property name="instrumenttest.out.dir" value="${build.dir}/test-reports/instrument"/>
+ <property name="doc.dir" location="doc"/>
+ <property name="doc.api.dir" location="${doc.dir}/api"/>
+ <property name="doc.reference.dir" location="${doc.dir}/reference"/>
+
+ <property name="dist.doc.dir" location="${dist.dir}/doc"/>
+ <property name="dist.api.dir" location="${dist.dir}/doc/api"/>
+
+ <property name="dist.src.dir" location="${dist.dir}/src"/>
+ <property name="dist.test.dir" location="${dist.dir}/test"/>
+ <property name="dist.lib.dir" location="${dist.dir}/lib"/>
+ <property name="jar.name" value="${name}"/>
+ <property name="jar.file.name" value="${dist.dir}/${jar.name}.jar"/>
+ <property name="jartest.file.name" value="${dist.dir}/${jar.name}-tests.jar"/>
+
+ <property name="javadoc" value="http://java.sun.com/j2se/1.4/docs/api"/>
+ <property name="javac.debug" value="on"/>
+ <property name="javac.optimize" value="off"/>
+ <property name="javac.source" value="1.4"/>
+ <property name="javac.target" value="1.4"/>
+
+ <property name="pom.file" value="pom.xml"/>
+ <property name="src.jar" value="${build.dir}/src.jar"/>
+
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
- <fileset dir="${common-build.basedir}/lib/build"><!-- ${build.lib.dir} fails in reference doc build -->
+ <fileset dir="${common-build.basedir}/lib/build">
+ <!-- ${build.lib.dir} fails in reference doc build -->
<include name="junit-*.jar"/>
<include name="ant-junit-*.jar"/>
</fileset>
</classpath>
- </taskdef>
-
- <taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
+ </taskdef>
+
+ <taskdef name="junitreport"
+ classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
<classpath>
- <fileset dir="${common-build.basedir}/lib/build"><!-- ${build.lib.dir} fails in reference doc build -->
+ <fileset dir="${common-build.basedir}/lib/build">
+ <!-- ${build.lib.dir} fails in reference doc build -->
<include name="junit-*.jar"/>
<include name="ant-junit-*.jar"/>
</fileset>
- </classpath>
- </taskdef>
-
- <!-- ivy load -->
- <property name="ivy.jar.dir" value="${common-build.basedir}/ivy" />
- <property name="ivy.conf.dir" value="${common-build.basedir}" />
- <path id="ivy.lib.path">
- <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
- </path>
- <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
- uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
-
- <!-- maven task load -->
- <path id="maven-ant-tasks.path" path="${ivy.jar.dir}/maven-ant-tasks.jar" />
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
- uri="urn:maven-artifact-ant"
- classpathref="maven-ant-tasks.path" />
-
- <artifact:remoteRepository id="offline.repository.jboss.org" url="file://${offline.repository.jboss.org}" />
-
- <path id="lib.class.path">
- <path refid="lib.moduleclass.path"/>
- <pathelement path="${clover.jar}"/>
- </path>
-
- <!-- overridable in modules -->
- <path id="lib.moduleclass.path"/>
-
- <patternset id="support.files">
- <include name="**/*.jpg"/>
- <include name="**/*.gif"/>
- <include name="**/*.dtd"/>
- <include name="**/*.xsd"/>
- <include name="**/*.xml"/>
- <include name="**/*.xslt"/>
-
- <!-- exclude everything we don't want in the jar -->
- <exclude name="${build.dir}/**/*"/>
- <exclude name="${doc.dir}/**/*"/>
- <exclude name="classes/**/*"/>
- <exclude name="build.xml"/>
- <exclude name="**/*.properties"/>
- <exclude name="**/*.ccf"/>
- <exclude name="**/*.cfg.xml"/>
- <exclude name="**/ehcache.xml"/>
- </patternset>
-
- <patternset id="source.files">
- <include name="**/*.java"/>
- <include name="**/*.properties"/>
- </patternset>
-
- <!-- junit paths/filesets -->
- <fileset dir="${testclasses.dir}" id="junit.batchtestset">
- <include name="**/*Test.class"/>
- </fileset>
-
- <path id="testsrc.path">
- <pathelement location="${test.dir}"/>
- </path>
-
- <!-- Clover -->
- <property name="clover.out.dir" value="cloverout"/>
- <property name="clover.jar" value="${ant.home}/lib/clover.jar"/>
- <taskdef resource="clovertasks"/>
-
- <path id="junit.classpath">
- <pathelement path="${classes.dir}"/>
- <pathelement path="${testclasses.dir}"/>
- <path refid="lib.class.path"/>
- <path refid="junit.moduleclasspath"/>
- <path location="${clover.jar}"/>
- </path>
-
- <!-- Clover tasks -->
- <target name="with.clover">
- <clover-setup initString="clover_coverage.db"/>
- </target>
-
- <target name="cloverreport.html" depends="with.clover"
- description="Generate a clover report from the current clover database.">
- <clover-report>
- <current outfile="${clover.out.dir}">
- <format type="html"/>
- </current>
- </clover-report>
- </target>
-
- <target name="cloverreport" depends="with.clover,junitreport,cloverreport.html"
- description="Run the tests and generate a clover report">
- </target>
-
- <!-- Tasks -->
-
- <target name="clean" description="Cleans up build and dist directories">
- <delete dir="${build.dir}"/>
- <delete dir="${dist.target.dir}"/>
- <delete dir="${clover.out.dir}"/>
- </target>
-
- <target name="init" description="Initialize the build">
- <tstamp>
- <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/>
- </tstamp>
- <echo message="Build ${Name}-${version} (${subversion})"/>
- <mkdir dir="${classes.dir}"/>
- <mkdir dir="${testclasses.dir}"/>
- <copy todir="${classes.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
-
- <copy todir="${build.dir}">
- <fileset dir=".">
- <include name="readme.txt"/>
- <include name="lgpl.txt"/>
- </fileset>
- </copy>
- </target>
-
- <target name="compile" depends="init" description="Compile the Java source code">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- target="${javac.target}"
- source="${javac.source}"
- srcdir="${src.dir}"
- destdir="${classes.dir}"
- classpathref="lib.class.path"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on">
- </javac>
- </target>
-
- <target name="compiletest" depends="compile" description="Compile the tests">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- target="${javac.target}"
- source="${javac.source}"
- destdir="${testclasses.dir}"
- classpathref="junit.classpath"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on">
- <src refid="testsrc.path"/>
- </javac>
+ </classpath>
+ </taskdef>
+
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+ <fileset dir="${common-build.basedir}/lib/build">
+ <!-- ${build.lib.dir} fails in reference doc build -->
+ <include name="ant-contrib-*.jar"/>
+ </fileset>
+ </classpath>
+ </taskdef>
+
+ <!-- ivy load -->
+ <property name="ivy.jar.dir" value="${common-build.basedir}/ivy"/>
+ <property name="ivy.conf.dir" value="${common-build.basedir}"/>
+ <path id="ivy.lib.path">
+ <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
+ </path>
+ <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
+ uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
+
+ <!-- maven task load -->
+ <path id="maven-ant-tasks.path" path="${ivy.jar.dir}/maven-ant-tasks.jar"/>
+ <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
+ uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.path"/>
+
+ <artifact:remoteRepository id="offline.repository.jboss.org"
+ url="file://${offline.repository.jboss.org}"/>
+
+ <path id="lib.class.path">
+ <path refid="lib.moduleclass.path"/>
+ <pathelement path="${clover.jar}"/>
+ </path>
+
+ <!-- overridable in modules -->
+ <path id="lib.moduleclass.path"/>
+
+ <patternset id="support.files">
+ <include name="**/*.jpg"/>
+ <include name="**/*.gif"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.xsd"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xslt"/>
+
+ <!-- exclude everything we don't want in the jar -->
+ <exclude name="${build.dir}/**/*"/>
+ <exclude name="${doc.dir}/**/*"/>
+ <exclude name="classes/**/*"/>
+ <exclude name="build.xml"/>
+ <exclude name="**/*.properties"/>
+ <exclude name="**/*.ccf"/>
+ <exclude name="**/*.cfg.xml"/>
+ <exclude name="**/ehcache.xml"/>
+ </patternset>
+
+ <patternset id="source.files">
+ <include name="**/*.java"/>
+ <include name="**/*.properties"/>
+ </patternset>
+
+ <!-- junit paths/filesets -->
+ <fileset dir="${testclasses.dir}" id="junit.batchtestset">
+ <include name="**/*Test.class"/>
+ </fileset>
+
+ <path id="testsrc.path">
+ <pathelement location="${test.dir}"/>
+ </path>
+
+ <path id="junit.classpath">
+ <pathelement path="${classes.dir}"/>
+ <pathelement path="${testclasses.dir}"/>
+ <path refid="lib.class.path"/>
+ <path refid="junit.moduleclasspath"/>
+ <path location="${clover.jar}"/>
+ </path>
+
+ <!-- Determine the database against which to run tests-->
+ <if>
+ <equals arg1="${targetdb}" arg2="$${targetdb}"/>
+ <then>
+ <echo message="No target database specified using default HSQLDB"/>
+ <property name="targetdb" value="hsqldb"/>
+ </then>
+ </if>
+
+ <!-- Clover tasks -->
+ <target name="with.clover">
+ <clover-setup initString="clover_coverage.db"/>
+ </target>
+
+ <target name="cloverreport.html" depends="with.clover"
+ description="Generate a clover report from the current clover database.">
+ <clover-report>
+ <current outfile="${clover.out.dir}">
+ <format type="html"/>
+ </current>
+ </clover-report>
+ </target>
+
+ <target name="cloverreport"
+ depends="with.clover,junitreport,cloverreport.html"
+ description="Run the tests and generate a clover report">
+ </target>
+
+ <!-- Tasks -->
+ <target name="clean" description="Cleans up build and dist directories">
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.target.dir}"/>
+ <delete dir="${clover.out.dir}"/>
+ </target>
+
+ <target name="init" description="Initialize the build">
+ <tstamp>
+ <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/>
+ </tstamp>
+ <echo message="Build ${Name}-${version} (${subversion})"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${testclasses.dir}"/>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}">
+ <patternset refid="support.files"/>
+ </fileset>
+ </copy>
+
+ <copy todir="${build.dir}">
+ <fileset dir=".">
+ <include name="readme.txt"/>
+ <include name="lgpl.txt"/>
+ </fileset>
+ </copy>
</target>
-
- <target name="instrument" depends="compiletest"
- description="Instrument the persistent classes"> <!-- depends="jar" -->
-
- <taskdef name="instrument" classname="org.hibernate.tool.instrument.InstrumentTask">
- <classpath path="${classes.dir}"/>
- <classpath path="${testclasses.dir}"/>
- <classpath refid="lib.class.path"/>
- </taskdef>
-
- <instrument verbose="true">
- <fileset dir="${testclasses.dir}/org/hibernate/test">
- <include name="**/*.class"/>
- <exclude name="**/*Test$*.class"/>
- <exclude name="**/*Test.class"/>
- <exclude name="**/*Tests.class"/>
- </fileset>
- </instrument>
-
- <!-- jar jarfile="${build.dir}/instrumented-classes.jar">
- <fileset dir="${testclasses.dir}">
- <include name="org/hibernate/test/**/*.class"/>
- <exclude name="org/hibernate/test/**/*Test.class"/>
- </fileset>
- </jar -->
-
- </target>
-
- <target name="copytest" description="Copy tests to dist dir" if="copy.test" >
- <mkdir dir="${dist.test.dir}"/>
- <copy todir="${dist.test.dir}">
- <fileset dir="${test.dir}"/>
- </copy>
- </target>
-
- <target name="copysource" depends="copytest" description="Copy sources to dist dir">
- <mkdir dir="${dist.src.dir}"/>
- <copy todir="${dist.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="source.files"/>
- </fileset>
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- <mkdir dir="${dist.src.dir}"/>
- <copy todir="${dist.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="source.files"/>
- </fileset>
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- </target>
+ <target name="get.deps.core" depends="init"
+ description="retrieve the core dependencies">
+ <ivy:resolve conf="default"/>
+ <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]"
+ conf="default"/>
+ </target>
+
+ <target name="get.deps.test" depends="init"
+ description="retrieve the test dependencies">
+ <ivy:resolve conf="test"/>
+ <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test"/>
+ </target>
+
+ <target name="copytest" description="Copy tests to dist dir" if="copy.test">
+ <mkdir dir="${dist.test.dir}"/>
+ <copy todir="${dist.test.dir}">
+ <fileset dir="${test.dir}"/>
+ </copy>
+ </target>
+
+ <target name="copysource" depends="copytest"
+ description="Copy sources to dist dir">
+ <mkdir dir="${dist.src.dir}"/>
+ <copy todir="${dist.src.dir}">
+ <fileset dir="${src.dir}">
+ <patternset refid="source.files"/>
+ </fileset>
+ <fileset dir="${src.dir}">
+ <patternset refid="support.files"/>
+ </fileset>
+ </copy>
+ <mkdir dir="${dist.src.dir}"/>
+ <copy todir="${dist.src.dir}">
+ <fileset dir="${src.dir}">
+ <patternset refid="source.files"/>
+ </fileset>
+ <fileset dir="${src.dir}">
+ <patternset refid="support.files"/>
+ </fileset>
+ </copy>
+ </target>
+
<target name="copylib" description="Copy jars to lib dir">
<mkdir dir="${dist.lib.dir}"/>
<copy todir="${dist.lib.dir}" verbose="true">
@@ -283,194 +254,197 @@
</fileset>
</copy>
</target>
+
+ <target name="copydoc" description="Copy doc to dist dir" if="copy.doc">
+ <mkdir dir="${dist.doc.dir}"/>
+ <copy todir="${dist.doc.dir}">
+ <fileset dir="${doc.dir}">
+ <include name="**/*.html"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="jar" depends="compile"
+ description="Build the distribution .jar file">
+ <mkdir dir="${dist.dir}"/>
+ <jar filesetmanifest="merge" jarfile="${jar.file.name}"
+ basedir="${classes.dir}"/>
+ </target>
+
+ <target name="jartest" depends="compiletest"
+ description="Build the distribution .jar file">
+ <mkdir dir="${dist.dir}"/>
+ <jar filesetmanifest="merge" jarfile="${jartest.file.name}"
+ basedir="${testclasses.dir}"/>
+ </target>
+
+ <!-- DOCUMENTATION -->
+
+ <target name="javadoc"
+ description="Compile the Javadoc API documentation to dist dir">
+ <mkdir dir="${dist.api.dir}"/>
+ <javadoc packagenames="${javadoc.packagenames}"
+ classpathref="lib.class.path" destdir="${dist.api.dir}" use="true"
+ protected="true" version="true"
+ windowtitle="${Name} API Documentation"
+ Overview="${doc.api.dir}/package.html"
+ doctitle="${Name} API Documentation"
+ stylesheetfile="${doc.api.dir}/jdstyle.css" link="${javadoc}">
+ <packageset dir="${src.dir}" defaultexcludes="yes">
+ <include name="**/*"/>
+ </packageset>
+ </javadoc>
+ </target>
+
+ <target name="extras" description="Copies miscellaneous files to root dir">
+ <copy todir="${dist.dir}/bin" failonerror="false">
+ <fileset dir="bin">
+ <include name="*.bat"/>
+ </fileset>
+ </copy>
+ <copy file="readme.txt" todir="${dist.dir}"/>
+ <copy file="lgpl.txt" todir="${dist.dir}"/>
+ <copy file="changelog.txt" todir="${dist.dir}"/>
+ <copy file="build.xml" todir="${dist.dir}"/>
+ <replace file="${dist.dir}/build.xml">
+ <replacetoken><![CDATA[../${name}-${version}]]>
+ </replacetoken>
+ <replacevalue><![CDATA[../${name}]]>
+ </replacevalue>
+ </replace>
+ </target>
+
+ <target name="dist" depends="jar,javadoc,copysource,copydoc,extras"
+ description="Build everything">
+ <zip zipfile="${dist.dir}-${version}.zip">
+ <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
+ </zip>
+ <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
+ <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
+ </tar>
+ </target>
+
+ <target name="info" description="Echoes useful system properties">
+ <echo message="java.vm.info=${java.vm.info}"/>
+ <echo message="java.vm.name=${java.vm.name}"/>
+ <echo message="java.vm.vendor=${java.vm.vendor}"/>
+ <echo message="java.vm.version=${java.vm.version}"/>
+ <echo message="os.arch=${os.arch}"/>
+ <echo message="os.name=${os.name}"/>
+ <echo message="os.version=${os.version}"/>
+ <echo message="java.home = ${java.home}"/>
+ <echo message="java.class.path = ${java.class.path}"/>
+ <echo message="build.compiler = ${build.compiler}"/>
+ <echo message="file.encoding=${file.encoding}"/>
+ <echo message="user.home = ${user.home}"/>
+ <echo message="user.language=${user.language}"/>
+ </target>
+
+ <target name="test-resources" description="Copies and filters test resources">
+ <filter filtersfile="${filter.dir}/${db}.filter"/>
+ <mkdir dir="${testclasses.dir}"/>
+ <copy todir="${testclasses.dir}" filtering="true" overwrite="true">
+ <fileset dir="${test.resources.dir}">
+ <include name="*.properties"/>
+ <include name="*.xml"/>
+ </fileset>
+ </copy>
+ </target>
- <target name="copydoc" description="Copy doc to dist dir" if="copy.doc">
- <mkdir dir="${dist.doc.dir}"/>
- <copy todir="${dist.doc.dir}">
- <fileset dir="${doc.dir}">
- <include name="**/*.html"/>
- </fileset>
- </copy>
- </target>
-
- <target name="jar" depends="compile" description="Build the distribution .jar file">
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jar.file.name}" basedir="${classes.dir}"/>
- </target>
-
- <target name="jartest" depends="compiletest" description="Build the distribution .jar file">
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jartest.file.name}" basedir="${testclasses.dir}"/>
- </target>
-
- <!-- DOCUMENTATION -->
-
- <target name="javadoc" description="Compile the Javadoc API documentation to dist dir">
- <mkdir dir="${dist.api.dir}"/>
- <javadoc
- packagenames="${javadoc.packagenames}"
- classpathref="lib.class.path"
- destdir="${dist.api.dir}"
- use="true"
- protected="true"
- version="true"
- windowtitle="${Name} API Documentation"
- Overview="${doc.api.dir}/package.html"
- doctitle="${Name} API Documentation"
- stylesheetfile="${doc.api.dir}/jdstyle.css"
- link="${javadoc}">
- <packageset dir="${src.dir}" defaultexcludes="yes" >
- <include name="**/*" />
- </packageset>
- </javadoc>
-
-
- </target>
-
-
- <target name="extras" description="Copies miscellaneous files to root dir">
- <copy todir="${dist.dir}/bin" failonerror="false">
- <fileset dir="bin">
- <include name="*.bat"/>
- </fileset>
- </copy>
- <copy file="readme.txt" todir="${dist.dir}"/>
- <copy file="lgpl.txt" todir="${dist.dir}"/>
- <copy file="changelog.txt" todir="${dist.dir}"/>
- <copy file="build.xml" todir="${dist.dir}"/>
- <replace file="${dist.dir}/build.xml">
- <replacetoken><![CDATA[../${name}-${version}]]></replacetoken>
- <replacevalue><![CDATA[../${name}]]></replacevalue>
- </replace>
- </target>
-
- <target name="dist" depends="jar,javadoc,copysource,copydoc,extras" description="Build everything">
- <zip zipfile = "${dist.dir}-${version}.zip">
- <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </zip>
- <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
- <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </tar>
- </target>
-
- <target name="info" description="Echoes useful system properties">
- <echo message="java.vm.info=${java.vm.info}"/>
- <echo message="java.vm.name=${java.vm.name}"/>
- <echo message="java.vm.vendor=${java.vm.vendor}"/>
- <echo message="java.vm.version=${java.vm.version}"/>
- <echo message="os.arch=${os.arch}"/>
- <echo message="os.name=${os.name}"/>
- <echo message="os.version=${os.version}"/>
- <echo message="java.home = ${java.home}"/>
- <echo message="java.class.path = ${java.class.path}"/>
- <echo message="build.compiler = ${build.compiler}"/>
- <echo message="file.encoding=${file.encoding}"/>
- <echo message="user.home = ${user.home}"/>
- <echo message="user.language=${user.language}"/>
- </target>
-
- <target name="junit" depends="compiletest">
- <mkdir dir="${testreports.dir}"/>
- <junit printsummary="yes" haltonfailure="yes" forkmode="once">
- <classpath refid="junit.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest fork="yes" todir="${testreports.dir}" haltonfailure="no">
- <fileset refid="junit.batchtestset"/>
- </batchtest>
- </junit>
- </target>
-
- <!-- Run a single unit test. -->
- <target name="junitsingle" depends="compiletest" description="Run a single test suite (requires testname and jdbc.driver properties)">
- <mkdir dir="${testreports.dir}"/>
- <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <target name="instrument" depends="compiletest"
+ description="Instrument the persistent classes"> <!-- depends="jar" -->
+
+ <taskdef name="instrument"
+ classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
<classpath refid="junit.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <test fork="yes" todir="${testreports.dir}" haltonfailure="no" name="${testname}"/>
- </junit>
- </target>
-
- <target name="junitinstrument" depends="compiletest,instrument"
- description="Run the instrument test suite (requires driver.jar property)">
- <mkdir dir="${instrumenttest.out.dir}"/>
- <junit printsummary="yes" haltonfailure="yes" dir="${basedir}"
- maxmemory="256M" fork="yes" forkmode="perBatch">
- <classpath refid="junit.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest todir="${instrumenttest.out.dir}" haltonfailure="no">
- <fileset dir="${classes.dir}">
- <include name="org/hibernate/test/**/*Test.class"/>
- </fileset>
- </batchtest>
- </junit>
- </target>
-
- <target name="junitreport" depends="">
- <junitreport todir="${testreports.dir}">
- <fileset dir="${testreports.dir}">
- <include name="TEST-*.xml"/>
- </fileset>
- <report format="frames" todir="${testreports.dir}"/>
- </junitreport>
- </target>
-
- <target name="run" depends="compile" description="Run Hibernate Console">
- <java classname="org.hibernate.console.Start" classpathref="lib.class.path" fork="true">
- <classpath>
- <path location="${build.dir}"/>
- </classpath>
- </java>
- </target>
-
-
- <target name="checkstyle" description="Check coding style">
- <taskdef resource="checkstyletask.properties">
- <classpath>
- <path refid="lib.class.path"/>
- <fileset dir="${common-build.basedir}/lib">
- <include name="checkstyle*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <checkstyle config="${common-build.basedir}/checkstyle_checks.xml">
- <fileset dir="${src.dir}">
- <include name="**/*.java"/>
+ </taskdef>
+
+ <instrument verbose="true">
+ <fileset dir="${testclasses.dir}/org/hibernate/test">
+ <include name="**/*.class"/>
+ <exclude name="**/*Test$*.class"/>
+ <exclude name="**/*Test.class"/>
+ <exclude name="**/*Tests.class"/>
</fileset>
- <formatter type="plain"/>
- </checkstyle>
- </target>
-
- <target name="patch" depends="checkstyle"
- description="Create a patch">
- <cvs command="-q diff -u -N" output="patch.txt"/>
- </target>
-
- <!-- maven deploy: to be used by the subbuild and delcare deps on jar -->
- <target name="deploy" depends="jar">
- <fail unless="offline.repository.jboss.org" message="offline.repository.jboss.org must be defined"/>
- <jar jarfile="${src.jar}" basedir="${src.dir}">
- <include name="**/*.java" />
- <exclude name="**/test/*.java" />
- <!-- patternset refid="meta.files" / -->
- </jar>
-
- <artifact:pom id="maven.project" file="${pom.file}" />
-
- <artifact:install file="${jar.file.name}">
- <pom refid="maven.project"/>
- </artifact:install>
-
- <artifact:deploy file="${jar.file.name}">
- <pom refid="maven.project" />
- <remoteRepository refId="offline.repository.jboss.org">
- </remoteRepository>
- <attach file="${src.jar}" classifier="sources" />
- <attach file="${jar.file.name}" classifier="" />
- </artifact:deploy>
- </target>
-
+ </instrument>
+ </target>
+
+ <target name="junitinstrument" depends="compiletest,instrument"
+ description="Run the instrument test suite">
+ <for list="${targetdb}" param="db">
+ <sequential>
+ <antcall target="test-resources">
+ <param name="db" value="@{db}"/>
+ </antcall>
+ <mkdir dir="${instrumenttest.out.dir}/@{db}"/>
+ <echo>Running against db: @{db}</echo>
+ <junit printsummary="yes" haltonfailure="yes" dir="${basedir}"
+ maxmemory="256M" fork="yes" forkmode="perBatch">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest todir="${instrumenttest.out.dir}/@{db}" haltonfailure="no">
+ <fileset refid="junit.batchtestset"/>
+ </batchtest>
+ </junit>
+ </sequential>
+ </for>
+ </target>
+
+ <target name="junitreport" depends="">
+ <junitreport todir="${testreports.dir}">
+ <fileset dir="${testreports.dir}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${testreports.dir}"/>
+ </junitreport>
+ </target>
+
+ <target name="checkstyle" description="Check coding style">
+ <taskdef resource="checkstyletask.properties">
+ <classpath>
+ <path refid="lib.class.path"/>
+ <fileset dir="${common-build.basedir}/lib">
+ <include name="checkstyle*.jar"/>
+ </fileset>
+ </classpath>
+ </taskdef>
+
+ <checkstyle config="${common-build.basedir}/checkstyle_checks.xml">
+ <fileset dir="${src.dir}">
+ <include name="**/*.java"/>
+ </fileset>
+ <formatter type="plain"/>
+ </checkstyle>
+ </target>
+
+ <target name="patch" depends="checkstyle" description="Create a patch">
+ <cvs command="-q diff -u -N" output="patch.txt"/>
+ </target>
+
+ <!-- maven deploy: to be used by the subbuild and delcare deps on jar -->
+ <target name="deploy" depends="jar">
+ <fail unless="offline.repository.jboss.org"
+ message="offline.repository.jboss.org must be defined"/>
+ <jar jarfile="${src.jar}" basedir="${src.dir}">
+ <include name="**/*.java"/>
+ <exclude name="**/test/*.java"/>
+ <!-- patternset refid="meta.files" / -->
+ </jar>
+
+ <artifact:pom id="maven.project" file="${pom.file}"/>
+
+ <artifact:install file="${jar.file.name}">
+ <pom refid="maven.project"/>
+ </artifact:install>
+
+ <artifact:deploy file="${jar.file.name}">
+ <pom refid="maven.project"/>
+ <remoteRepository refId="offline.repository.jboss.org">
+ </remoteRepository>
+ <attach file="${src.jar}" classifier="sources"/>
+ <attach file="${jar.file.name}" classifier=""/>
+ </artifact:deploy>
+ </target>
+
</project>
\ No newline at end of file
Modified: annotations/trunk/doc/reference/build.xml
===================================================================
--- annotations/trunk/doc/reference/build.xml 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/doc/reference/build.xml 2008-08-11 09:14:39 UTC (rev 15025)
@@ -1,10 +1,7 @@
<project name="Documentation" default="all.doc" basedir=".">
- <!-- Use the core Hibernate3 doc build system -->
- <import file="../../common-build.xml"/>
<import file="docbook-common-build.xml"/>
-
<target name="all.doc" depends="clean">
<!-- TRANSLATOR: Duplicate this call for your language -->
Added: annotations/trunk/lib/build/ant-contrib-1.0b2.jar
===================================================================
(Binary files differ)
Property changes on: annotations/trunk/lib/build/ant-contrib-1.0b2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: annotations/trunk/src/filters/db2.filter
===================================================================
--- annotations/trunk/src/filters/db2.filter (rev 0)
+++ annotations/trunk/src/filters/db2.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,9 @@
+## DB2
+
+hibernate.dialect org.hibernate.dialect.DB2Dialect
+hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
+hibernate.connection.username hibernate
+hibernate.connection.password hibernate
+hibernate.connection.url jdbc:db2:hibernate
+
+
Property changes on: annotations/trunk/src/filters/db2.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/filters/derby.filter
===================================================================
--- annotations/trunk/src/filters/derby.filter (rev 0)
+++ annotations/trunk/src/filters/derby.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,9 @@
+## Derby
+
+hibernate.dialect org.hibernate.dialect.DerbyDialect
+hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
+hibernate.connection.username
+hibernate.connection.password
+hibernate.connection.url jdbc:derby:/hibernate;create=true
+
+
Property changes on: annotations/trunk/src/filters/derby.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/filters/hsqldb.filter
===================================================================
--- annotations/trunk/src/filters/hsqldb.filter (rev 0)
+++ annotations/trunk/src/filters/hsqldb.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,8 @@
+## HSQLDB
+
+hibernate.dialect org.hibernate.dialect.HSQLDialect
+hibernate.connection.driver_class org.hsqldb.jdbcDriver
+hibernate.connection.username sa
+hibernate.connection.password
+hibernate.connection.url jdbc\:hsqldb\:.
+
Property changes on: annotations/trunk/src/filters/hsqldb.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/filters/mckoi.filter
===================================================================
--- annotations/trunk/src/filters/mckoi.filter (rev 0)
+++ annotations/trunk/src/filters/mckoi.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,9 @@
+## Mckoi
+
+hibernate.dialect org.hibernate.dialect.MckoiDialect
+hibernate.connection.driver_class com.mckoi.JDBCDriver
+hibernate.connection.username hibernate
+hibernate.connection.password hibernate
+hibernate.connection.url jdbc:mckoi://localhost/hibernate
+
+
Property changes on: annotations/trunk/src/filters/mckoi.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/filters/mssql.filter
===================================================================
--- annotations/trunk/src/filters/mssql.filter (rev 0)
+++ annotations/trunk/src/filters/mssql.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,9 @@
+## MS SQL Server
+
+hibernate.dialect org.hibernate.dialect.SQLServerDialect
+hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
+hibernate.connection.username hibernate
+hibernate.connection.password hibernate
+hibernate.connection.url jdbc:jtds:sqlserver://localhost/hibernate
+
+
Property changes on: annotations/trunk/src/filters/mssql.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/filters/mysql.filter
===================================================================
--- annotations/trunk/src/filters/mysql.filter (rev 0)
+++ annotations/trunk/src/filters/mysql.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,7 @@
+## MySQL
+
+hibernate.dialect org.hibernate.dialect.MySQLDialect
+hibernate.connection.driver_class com.mysql.jdbc.Driver
+hibernate.connection.url jdbc:mysql://localhost/hibernate
+hibernate.connection.username hibernate
+hibernate.connection.password hibernate
Property changes on: annotations/trunk/src/filters/mysql.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/filters/oracle.filter
===================================================================
--- annotations/trunk/src/filters/oracle.filter (rev 0)
+++ annotations/trunk/src/filters/oracle.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,9 @@
+## Oracle
+
+hibernate.dialect org.hibernate.dialect.OracleDialect
+#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
+hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
+hibernate.connection.username hibernate
+hibernate.connection.password hibernate
+hibernate.connection.url jdbc:oracle:thin:@localhost:1521:hibernate
+
Property changes on: annotations/trunk/src/filters/oracle.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/filters/postgresql.filter
===================================================================
--- annotations/trunk/src/filters/postgresql.filter (rev 0)
+++ annotations/trunk/src/filters/postgresql.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,8 @@
+## PostgreSQL
+
+hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
+hibernate.connection.driver_class org.postgresql.Driver
+hibernate.connection.username hibernate
+hibernate.connection.password hibernate
+hibernate.connection.url jdbc:postgresql:hibernate
+
Property changes on: annotations/trunk/src/filters/postgresql.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: annotations/trunk/src/filters/sybase.filter
===================================================================
--- annotations/trunk/src/filters/sybase.filter (rev 0)
+++ annotations/trunk/src/filters/sybase.filter 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,9 @@
+## Sybase
+
+hibernate.dialect org.hibernate.dialect.SybaseDialect
+hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
+hibernate.connection.username hibernate
+hibernate.connection.password hibernate
+hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/hibernate
+
+
Property changes on: annotations/trunk/src/filters/sybase.filter
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Deleted: annotations/trunk/src/test/ehcache.xml
===================================================================
--- annotations/trunk/src/test/ehcache.xml 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/ehcache.xml 2008-08-11 09:14:39 UTC (rev 15025)
@@ -1,80 +0,0 @@
-<ehcache>
- <!-- Sets the path to the directory where cache .data files are created.
- If the path is a Java System Property it is replaced by
- its value in the running VM.
-
- The following properties are translated:
- user.home - User's home directory
- user.dir - User's current working directory
- java.io.tmpdir - Default temp file path -->
-
- <diskStore path="java.io.tmpdir"/>
- <!--Default Cache configuration. These will applied to caches programmatically created through
- the CacheManager.
- The following attributes are required for defaultCache:
- maxInMemory - Sets the maximum number of objects that will be created in memory
- eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
- is never expired.
- timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
- if the element is not eternal. Idle time is now - last accessed time
- timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
- if the element is not eternal. TTL is now - creation time
- overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
- has reached the maxInMemory limit.
-
- -->
-
- <defaultCache
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="120"
- timeToLiveSeconds="120"
- overflowToDisk="true"
- />
- <!--Predefined caches. Add your cache configuration settings here.
- If you do not have a configuration for your cache a WARNING will be issued when the
- CacheManager starts
- The following attributes are required for defaultCache:
- name - Sets the name of the cache. This is used to identify the cache. It must be unique.
- maxInMemory - Sets the maximum number of objects that will be created in memory
- eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
- is never expired.
- timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
- if the element is not eternal. Idle time is now - last accessed time
- timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
- if the element is not eternal. TTL is now - creation time
- overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
- has reached the maxInMemory limit.
- -->
-
- <!-- Sample cache named sampleCache1
- This cache contains a maximum in memory of 10000 elements, and will expire
- an element if it is idle for more than 5 minutes and lives for more than
- 10 minutes.
-
- If there are more than 10000 elements it will overflow to the
- disk cache, which in this configuration will go to wherever java.io.tmp is
- defined on your system. On a standard Linux system this will be /tmp"
- -->
-
- <cache name="sampleCache1"
- maxElementsInMemory="10000"
- eternal="false"
- timeToIdleSeconds="300"
- timeToLiveSeconds="600"
- overflowToDisk="true"
- />
-
- <!-- Sample cache named sampleCache2
- This cache contains 1000 elements. Elements will always be held in memory.
- They are not expired. -->
- <cache name="sampleCache2"
- maxElementsInMemory="1000"
- eternal="true"
- timeToIdleSeconds="0"
- timeToLiveSeconds="0"
- overflowToDisk="false"
- />
-
- <!-- Place configuration for your caches following -->
-</ehcache>
\ No newline at end of file
Deleted: annotations/trunk/src/test/hibernate.properties
===================================================================
--- annotations/trunk/src/test/hibernate.properties 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/hibernate.properties 2008-08-11 09:14:39 UTC (rev 15025)
@@ -1,470 +0,0 @@
-######################
-### Query Language ###
-######################
-
-## define query language constants / function names
-
-hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
-
-
-## select the classic query parser
-
-#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
-
-hibernate.format_sql true
-
-
-
-#################
-### Platforms ###
-#################
-
-## JNDI Datasource
-
-#hibernate.connection.datasource jdbc/test
-#hibernate.connection.username db2
-#hibernate.connection.password db2
-
-
-## HypersonicSQL
-
-hibernate.dialect org.hibernate.dialect.HSQLDialect
-hibernate.connection.driver_class org.hsqldb.jdbcDriver
-hibernate.connection.username sa
-hibernate.connection.password
-hibernate.connection.url jdbc\:hsqldb\:.
-
-
-## MySQL
-
-#hibernate.dialect org.hibernate.dialect.MySQLDialect
-#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
-#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
-#hibernate.connection.driver_class com.mysql.jdbc.Driver
-#hibernate.connection.url jdbc:mysql://localhost/hibernate
-#hibernate.connection.username hibernate
-#hibernate.connection.password hibernate
-
-
-## Oracle
-
-#hibernate.dialect org.hibernate.dialect.OracleDialect
-#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
-#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
-#hibernate.connection.username ora
-#hibernate.connection.password ora
-#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
-
-
-## PostgreSQL
-
-#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
-#hibernate.connection.driver_class org.postgresql.Driver
-#hibernate.connection.url jdbc:postgresql:annotations
-#hibernate.connection.username postgres
-#hibernate.connection.password hibernate
-#hibernate.query.substitutions yes 'Y', no 'N'
-
-
-## DB2
-
-#hibernate.dialect org.hibernate.dialect.DB2Dialect
-#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2:test
-#hibernate.connection.username db2
-#hibernate.connection.password db2
-
-## TimesTen (not supported yet)
-
-#hibernate.dialect org.hibernate.dialect.TimesTenDialect
-#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
-#hibernate.connection.url jdbc:timesten:direct:test
-#hibernate.connection.username
-#hibernate.connection.password
-
-## DB2/400
-
-#hibernate.dialect org.hibernate.dialect.DB2400Dialect
-#hibernate.connection.username user
-#hibernate.connection.password password
-
-## Native driver
-#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
-#hibernate.connection.url jdbc:db2://systemname
-
-## Toolbox driver
-#hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
-#hibernate.connection.url jdbc:as400://systemname
-
-
-## Derby (Not supported!)
-
-#hibernate.dialect org.hibernate.dialect.DerbyDialect
-#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
-#hibernate.connection.username
-#hibernate.connection.password
-#hibernate.connection.url jdbc:derby:/test;create=true
-
-
-## Sybase
-
-#hibernate.dialect org.hibernate.dialect.SybaseDialect
-#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
-#hibernate.connection.username sa
-#hibernate.connection.password sasasa
-#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb
-
-
-## Mckoi SQL
-
-#hibernate.dialect org.hibernate.dialect.MckoiDialect
-#hibernate.connection.driver_class com.mckoi.JDBCDriver
-#hibernate.connection.url jdbc:mckoi:///
-#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
-#hibernate.connection.username admin
-#hibernate.connection.password nimda
-
-
-## SAP DB
-
-#hibernate.dialect org.hibernate.dialect.SAPDBDialect
-#hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
-#hibernate.connection.url jdbc:sapdb://localhost/TST
-#hibernate.connection.username TEST
-#hibernate.connection.password TEST
-#hibernate.query.substitutions yes 'Y', no 'N'
-
-
-## MS SQL Server
-
-#hibernate.dialect org.hibernate.dialect.SQLServerDialect
-#hibernate.connection.username sa
-#hibernate.connection.password sa
-
-## JSQL Driver
-#hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
-#hibernate.connection.url jdbc:JSQLConnect://1E1/test
-
-## JTURBO Driver
-#hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
-#hibernate.connection.url jdbc:JTurbo://1E1:1433/test
-
-## WebLogic Driver
-#hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
-#hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
-
-## Microsoft Driver (not recommended!)
-#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
-#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
-
-## jTDS (since version 0.9)
-#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
-#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
-
-## Interbase
-
-#hibernate.dialect org.hibernate.dialect.InterbaseDialect
-#hibernate.connection.username sysdba
-#hibernate.connection.password masterkey
-
-## DO NOT specify hibernate.connection.sqlDialect
-
-## InterClient
-
-#hibernate.connection.driver_class interbase.interclient.Driver
-#hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb
-
-## Pure Java
-
-#hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
-#hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
-
-
-## Pointbase
-
-#hibernate.dialect org.hibernate.dialect.PointbaseDialect
-#hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver
-#hibernate.connection.url jdbc:pointbase:embedded:sample
-#hibernate.connection.username PBPUBLIC
-#hibernate.connection.password PBPUBLIC
-
-
-
-#################################
-### Hibernate Connection Pool ###
-#################################
-
-hibernate.connection.pool_size 1
-
-
-
-###########################
-### C3P0 Connection Pool###
-###########################
-
-#hibernate.c3p0.max_size 2
-#hibernate.c3p0.min_size 2
-#hibernate.c3p0.timeout 5000
-#hibernate.c3p0.max_statements 100
-#hibernate.c3p0.idle_test_period 3000
-#hibernate.c3p0.acquire_increment 2
-#hibernate.c3p0.validate false
-
-
-
-##############################
-### Proxool Connection Pool###
-##############################
-
-## Properties for external configuration of Proxool
-
-hibernate.proxool.pool_alias pool1
-
-## Only need one of the following
-
-#hibernate.proxool.existing_pool true
-#hibernate.proxool.xml proxool.xml
-#hibernate.proxool.properties proxool.properties
-
-
-
-#################################
-### Plugin ConnectionProvider ###
-#################################
-
-## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)
-
-#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
-#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
-
-
-
-#######################
-### Transaction API ###
-#######################
-
-## Enable automatic flush during the JTA beforeCompletion() callback
-## (This setting is relevant with or without the Transaction API)
-
-#hibernate.transaction.flush_before_completion
-
-
-## Enable automatic session close at the end of transaction
-## (This setting is relevant with or without the Transaction API)
-
-#hibernate.transaction.auto_close_session
-
-
-## the Transaction API abstracts application code from the underlying JTA or JDBC transactions
-
-#hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
-#hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory
-
-
-## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
-## default is java:comp/UserTransaction
-## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class
-
-#jta.UserTransaction jta/usertransaction
-#jta.UserTransaction javax.transaction.UserTransaction
-#jta.UserTransaction UserTransaction
-
-
-## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA TransactionManager
-
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup
-#hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup
-
-
-
-##############################
-### Miscellaneous Settings ###
-##############################
-
-## print all generated SQL to the console
-
-#hibernate.show_sql true
-
-
-## add comments to the generated SQL
-
-#hibernate.use_sql_comments true
-
-
-## generate statistics
-
-#hibernate.generate_statistics true
-
-
-## auto schema export
-
-#hibernate.hbm2ddl.auto create-drop
-#hibernate.hbm2ddl.auto create
-#hibernate.hbm2ddl.auto update
-
-
-## specify a default schema and catalog for unqualified tablenames
-
-#hibernate.default_schema test
-#hibernate.default_catalog test
-
-
-## enable ordering of SQL UPDATEs by primary key
-
-hibernate.order_updates true
-
-
-## set the maximum depth of the outer join fetch tree
-
-hibernate.max_fetch_depth 1
-
-
-## set the default batch size for batch fetching
-
-hibernate.default_batch_fetch_size 100
-
-
-## rollback generated identifier values of deleted entities to default values
-
-#hibernate.use_identifer_rollback true
-
-
-## enable CGLIB reflection optimizer (enabled by default)
-
-#hibernate.cglib.use_reflection_optimizer false
-
-
-
-#####################
-### JDBC Settings ###
-#####################
-
-## specify a JDBC isolation level
-
-#hibernate.connection.isolation 4
-
-
-## enable JDBC autocommit (not recommended!)
-
-#hibernate.connection.autocommit true
-
-
-## set the JDBC fetch size
-
-#hibernate.jdbc.fetch_size 25
-
-
-## set the maximum JDBC 2 batch size (a nonzero value enables batching)
-
-#hibernate.jdbc.batch_size 0
-
-
-## enable batch updates even for versioned data
-
-hibernate.jdbc.batch_versioned_data true
-
-
-## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
-
-#hibernate.jdbc.use_scrollable_resultset true
-
-
-## use streams when writing binary types to / from JDBC
-
-hibernate.jdbc.use_streams_for_binary true
-
-
-## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
-
-#hibernate.jdbc.use_get_generated_keys false
-
-
-## choose a custom JDBC batcher
-
-# hibernate.jdbc.factory_class
-
-
-## enable JDBC result set column alias caching
-## (minor performance enhancement for broken JDBC drivers)
-
-# hibernate.jdbc.wrap_result_sets
-
-
-## choose a custom SQL exception converter
-
-#hibernate.jdbc.sql_exception_converter
-
-
-
-##########################
-### Second-level Cache ###
-##########################
-
-## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)
-
-#hibernate.cache.use_minimal_puts true
-
-
-## set a prefix for cache region names
-
-hibernate.cache.region_prefix hibernate.test
-
-
-## disable the second-level cache
-
-#hibernate.cache.use_second_level_cache false
-
-
-## enable the query cache
-
-hibernate.cache.use_query_cache true
-
-
-## store the second-level cache entries in a more human-friendly format
-
-#hibernate.cache.use_structured_entries true
-
-
-## choose a cache implementation
-
-#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
-hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
-#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider
-
-
-## choose a custom query cache implementation
-
-#hibernate.cache.query_cache_factory
-
-
-
-############
-### JNDI ###
-############
-
-## specify a JNDI name for the SessionFactory
-
-#hibernate.session_factory_name hibernate/session_factory
-
-
-## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
-## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
-## is the best approach in an application server
-
-#file system
-#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
-#hibernate.jndi.url file:/
-
-#WebSphere
-#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
-#hibernate.jndi.url iiop://localhost:900/
-
Deleted: annotations/trunk/src/test/log4j.properties
===================================================================
--- annotations/trunk/src/test/log4j.properties 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/log4j.properties 2008-08-11 09:14:39 UTC (rev 15025)
@@ -1,51 +0,0 @@
-### direct log messages to stdout ###
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### direct messages to file hibernate.log ###
-log4j.appender.file=org.apache.log4j.FileAppender
-log4j.appender.file.File=hibernate.log
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
-
-### direct messages to socket - chainsaw ###
-log4j.appender.socket=org.apache.log4j.net.SocketAppender
-log4j.appender.socket.remoteHost=localhost
-log4j.appender.socket.port=4560
-log4j.appender.socket.locationInfo=true
-
-
-### set log levels - for more verbose logging change 'info' to 'debug' ###
-
-log4j.rootLogger=warn, stdout
-
-log4j.logger.org.hibernate=debug
-
-
-### log just the SQL
-log4j.logger.org.hibernate.SQL=debug
-
-#log4j.logger.org.hibernate.engine.CascadingAction=debug
-
-### log JDBC bind parameters ###
-log4j.logger.org.hibernate.type=debug
-
-### log schema export/update ###
-log4j.logger.org.hibernate.tool.hbm2ddl=debug
-
-### log cache activity ###
-log4j.logger.org.hibernate.cache=debug
-
-### enable the following line if you want to track down connection ###
-### leakages when using DriverManagerConnectionProvider ###
-#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
-
-### annotation logs
-#log4j.logger.org.hibernate.annotation=info
-#log4j.logger.org.hibernate.cfg=info
-#log4j.logger.org.hibernate.cfg.SettingsFactory=info
-#log4j.logger.org.hibernate.cfg.AnnotationBinder=info
-#log4j.logger.org.hibernate.cfg.AnnotationConfiguration=info
-#log4j.logger.org.hibernate.cfg.Ejb3Column=info
\ No newline at end of file
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/EntityTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/EntityTest.java 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/EntityTest.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -57,6 +57,19 @@
Transaction tx = s.beginTransaction();
Flight firstOne = new Flight();
firstOne.setId( new Long( 1 ) );
+ firstOne.setName( "AF3202" );
+ firstOne.setDuration( new Long( 1000000 ) );
+ firstOne.setDurationInSec( 2000 );
+ s.save( firstOne );
+ s.flush();
+ tx.commit();
+ s.close();
+
+
+ s = openSession();
+ tx = s.beginTransaction();
+ firstOne = new Flight();
+ firstOne.setId( new Long( 1 ) );
firstOne.setName( null );
try {
Added: annotations/trunk/src/test/org/hibernate/test/annotations/RequiresDialect.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/RequiresDialect.java (rev 0)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/RequiresDialect.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,20 @@
+// $Id:$
+package org.hibernate.test.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.hibernate.dialect.Dialect;
+
+/**
+ * Annotations used to mark a test to be specific to a given dialect.
+ *
+ * @author Hardy Ferentschik
+ */
+(a)Target({ElementType.METHOD, ElementType.TYPE})
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface RequiresDialect {
+ Class<? extends Dialect>[] value();
+}
Property changes on: annotations/trunk/src/test/org/hibernate/test/annotations/RequiresDialect.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/TestCase.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/TestCase.java 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/TestCase.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -2,99 +2,194 @@
package org.hibernate.test.annotations;
import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
import org.hibernate.HibernateException;
+import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
-import org.hibernate.Interceptor;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.Dialect;
+import org.hibernate.jdbc.Work;
+import org.hibernate.tool.hbm2ddl.SchemaExport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * A base class for all tests.
+ *
+ * @author Emmnauel Bernand
+ * @author Hardy Ferentschik
+ */
public abstract class TestCase extends junit.framework.TestCase {
+ public static final Logger log = LoggerFactory.getLogger(TestCase.class);
+
private static SessionFactory sessions;
private static AnnotationConfiguration cfg;
private static Dialect dialect;
- private static Class lastTestClass;
+ private static Class<?> lastTestClass;
private Session session;
+ /**
+ * The test method.
+ */
+ private Method runMethod = null;
+
+ /**
+ * Flag indicating whether the test should be skipped.
+ */
+ private boolean skip = false;
+
public TestCase() {
super();
}
public TestCase(String x) {
- super( x );
+ super(x);
}
- protected void buildSessionFactory(Class[] classes, String[] packages, String[] xmlFiles) throws Exception {
+ protected void buildSessionFactory( Class<?>[] classes, String[] packages, String[] xmlFiles ) throws Exception {
- if ( getSessions() != null ) getSessions().close();
+ if ( getSessions() != null )
+ getSessions().close();
try {
- setCfg( new AnnotationConfiguration() );
- configure( cfg );
+ setCfg(new AnnotationConfiguration());
+ configure(cfg);
if ( recreateSchema() ) {
- cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
+ cfg.setProperty(Environment.HBM2DDL_AUTO, "create-drop");
}
- for ( int i = 0; i < packages.length ; i++ ) {
- getCfg().addPackage( packages[i] );
+ for ( int i = 0; i < packages.length; i++ ) {
+ getCfg().addPackage(packages[i]);
}
- for ( int i = 0; i < classes.length ; i++ ) {
- getCfg().addAnnotatedClass( classes[i] );
+ for ( int i = 0; i < classes.length; i++ ) {
+ getCfg().addAnnotatedClass(classes[i]);
}
- for ( int i = 0; i < xmlFiles.length ; i++ ) {
- InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( xmlFiles[i] );
- getCfg().addInputStream( is );
+ for ( int i = 0; i < xmlFiles.length; i++ ) {
+ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(xmlFiles[i]);
+ getCfg().addInputStream(is);
}
- setDialect( Dialect.getDialect() );
- setSessions( getCfg().buildSessionFactory( /*new TestInterceptor()*/ ) );
- }
- catch (Exception e) {
+ setDialect(Dialect.getDialect());
+ setSessions(getCfg().buildSessionFactory( /* new TestInterceptor() */));
+ } catch ( Exception e ) {
e.printStackTrace();
throw e;
}
}
protected void setUp() throws Exception {
- if ( getSessions() == null || lastTestClass != getClass() ) {
- buildSessionFactory( getMappings(), getAnnotatedPackages(), getXmlFiles() );
- lastTestClass = getClass();
+ runMethod = findTestMethod();
+ checkSkip(runMethod);
+ if ( !skip ) {
+ if ( getSessions() == null || lastTestClass != getClass() ) {
+ buildSessionFactory(getMappings(), getAnnotatedPackages(), getXmlFiles());
+ lastTestClass = getClass();
+ } else {
+ runSchemaGeneration();
+ }
}
}
-
+
protected void runTest() throws Throwable {
try {
- super.runTest();
+ if ( !skip ) {
+ runTestMethod(runMethod);
+ handleUnclosedSession();
+ }
+ } catch ( Throwable e ) {
+ closeSession(e);
+ }
+ }
+
+ private void checkSkip( Method runMethod ) {
+ Set<Class<? extends Dialect>> dialectList = new HashSet<Class<? extends Dialect>>();
+
+ RequiresDialect requiresDialectMethodAnn = runMethod.getAnnotation(RequiresDialect.class);
+ if ( requiresDialectMethodAnn != null ) {
+ Class<? extends Dialect>[] requiredDialects = requiresDialectMethodAnn.value();
+ dialectList.addAll(Arrays.asList(requiredDialects));
+ }
+
+ RequiresDialect requiresDialectClassAnn = getClass().getAnnotation(RequiresDialect.class);
+ if ( requiresDialectClassAnn != null ) {
+ Class<? extends Dialect>[] requiredDialects = requiresDialectClassAnn.value();
+ dialectList.addAll(Arrays.asList(requiredDialects));
+ }
+
+ if ( dialectList.isEmpty() || dialectList.contains(Dialect.getDialect().getClass()) ) {
+ skip = false;
+ } else {
+ log.warn("Skipping test {}, because test does not apply for dialect {}", runMethod.getName(), Dialect
+ .getDialect().getClass());
+ skip = true;
+ }
+ }
+
+ private void runTestMethod( Method runMethod ) throws Throwable, IllegalAccessException {
+ try {
+ runMethod.invoke(this, new Class[0]);
+ } catch ( InvocationTargetException e ) {
+ e.fillInStackTrace();
+ throw e.getTargetException();
+ } catch ( IllegalAccessException e ) {
+ e.fillInStackTrace();
+ throw e;
+ }
+ }
+
+ private Method findTestMethod() {
+ String fName = getName();
+ assertNotNull(fName);
+ Method runMethod = null;
+ try {
+ runMethod = getClass().getMethod(fName, null);
+ } catch ( NoSuchMethodException e ) {
+ fail("Method \"" + fName + "\" not found");
+ }
+ if ( !Modifier.isPublic(runMethod.getModifiers()) ) {
+ fail("Method \"" + fName + "\" should be public");
+ }
+ return runMethod;
+ }
+
+ private void handleUnclosedSession() {
+ if ( session != null && session.isOpen() ) {
+ if ( session.isConnected() )
+ session.doWork(new RollbackWork());
+ session.close();
+ session = null;
+ fail("unclosed session");
+ } else {
+ session = null;
+ }
+ }
+
+ private void closeSession( Throwable e ) throws Throwable {
+ try {
if ( session != null && session.isOpen() ) {
- if ( session.isConnected() ) session.connection().rollback();
+ if ( session.isConnected() )
+ session.doWork(new RollbackWork());
session.close();
- session = null;
- fail( "unclosed session" );
}
- else {
- session = null;
- }
+ } catch ( Exception ignore ) {
}
- catch (Throwable e) {
- try {
- if ( session != null && session.isOpen() ) {
- if ( session.isConnected() ) session.connection().rollback();
- session.close();
- }
+ try {
+ if ( sessions != null ) {
+ sessions.close();
+ sessions = null;
}
- catch (Exception ignore) {
- }
- try {
- if ( sessions != null ) {
- sessions.close();
- sessions = null;
- }
- }
- catch (Exception ignore) {
- }
- throw e;
+ } catch ( Exception ignore ) {
}
+ throw e;
}
public Session openSession() throws HibernateException {
@@ -102,22 +197,22 @@
return session;
}
- public Session openSession(Interceptor interceptor) throws HibernateException {
+ public Session openSession( Interceptor interceptor ) throws HibernateException {
session = getSessions().openSession(interceptor);
return session;
}
- protected abstract Class[] getMappings();
+ protected abstract Class<?>[] getMappings();
protected String[] getAnnotatedPackages() {
- return new String[]{};
+ return new String[] {};
}
protected String[] getXmlFiles() {
- return new String[]{};
+ return new String[] {};
}
- private void setSessions(SessionFactory sessions) {
+ private void setSessions( SessionFactory sessions ) {
TestCase.sessions = sessions;
}
@@ -125,7 +220,7 @@
return sessions;
}
- private void setDialect(Dialect dialect) {
+ private void setDialect( Dialect dialect ) {
TestCase.dialect = dialect;
}
@@ -133,7 +228,7 @@
return dialect;
}
- protected static void setCfg(AnnotationConfiguration cfg) {
+ protected static void setCfg( AnnotationConfiguration cfg ) {
TestCase.cfg = cfg;
}
@@ -141,14 +236,22 @@
return cfg;
}
- protected void configure(Configuration cfg) {
- //cfg.setNamingStrategy( AlternativeNamingStrategy.INSTANCE );
- //cfg.getSessionEventListenerConfig().setFlushEventListener( new EJB3FlushEventListener() );
- //cfg.getSessionEventListenerConfig().setAutoFlushEventListener( new EJB3AutoFlushEventListener() );
+ protected void configure( Configuration cfg ) {
}
protected boolean recreateSchema() {
return true;
}
+ protected void runSchemaGeneration() {
+ SchemaExport export = new SchemaExport(cfg);
+ export.create(true, true);
+ }
+
+ public class RollbackWork implements Work {
+
+ public void execute( Connection connection ) throws SQLException {
+ connection.rollback();
+ }
+ }
}
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/access/AccessTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/access/AccessTest.java 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/access/AccessTest.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -9,7 +9,7 @@
* @author Emmanuel Bernard
*/
public class AccessTest extends TestCase {
-
+
public void testSuperclassOverriding() throws Exception {
Furniture fur = new Furniture();
fur.setColor( "Black" );
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/id/IdTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/id/IdTest.java 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/id/IdTest.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -3,7 +3,9 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.dialect.HSQLDialect;
import org.hibernate.mapping.Column;
+import org.hibernate.test.annotations.RequiresDialect;
import org.hibernate.test.annotations.TestCase;
import org.hibernate.test.annotations.id.entities.Ball;
import org.hibernate.test.annotations.id.entities.BreakDance;
@@ -27,13 +29,9 @@
* @author Emmanuel Bernard
*/
@SuppressWarnings("unchecked")
+(a)RequiresDialect(HSQLDialect.class)
public class IdTest extends TestCase {
// FIXME split Sequence and Id tests to explicit the run failure on Oracle etc
-
- public IdTest(String x) {
- super(x);
- }
-
public void testGenericGenerator() throws Exception {
Session s = openSession();
Transaction tx = s.beginTransaction();
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -9,6 +9,8 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.Hibernate;
+import org.hibernate.dialect.HSQLDialect;
+import org.hibernate.test.annotations.RequiresDialect;
import org.hibernate.test.annotations.TestCase;
/**
@@ -254,6 +256,7 @@
s.close();
}
+ @RequiresDialect(HSQLDialect.class)
public void testComponentSubPropertyMapKey() throws Exception {
Session s;
Transaction tx;
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/join/JoinTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/join/JoinTest.java 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/join/JoinTest.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -17,10 +17,6 @@
*/
public class JoinTest extends TestCase {
- public JoinTest(String x) {
- super( x );
- }
-
public void testDefaultValue() throws Exception {
Join join = (Join) getCfg().getClassMapping( Life.class.getName() ).getJoinClosureIterator().next();
assertEquals( "ExtendedLife", join.getTable().getName() );
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/manytomany/ManyToManyTest.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -14,6 +14,8 @@
import org.hibernate.JDBCException;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.dialect.HSQLDialect;
+import org.hibernate.test.annotations.RequiresDialect;
import org.hibernate.test.annotations.TestCase;
/**
@@ -79,6 +81,7 @@
s.close();
}
+ @RequiresDialect(HSQLDialect.class)
public void testDefaultCompositePk() throws Exception {
Session s;
Transaction tx;
@@ -282,6 +285,7 @@
*
*
*/
+ @RequiresDialect(HSQLDialect.class)
public void testOrderByContractor() throws Exception {
Session s;
@@ -419,6 +423,7 @@
s.close();
}
+ @RequiresDialect(HSQLDialect.class)
public void testCompositePk() throws Exception {
Session s;
Transaction tx;
Modified: annotations/trunk/src/test/org/hibernate/test/annotations/onetomany/OneToManyTest.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/onetomany/OneToManyTest.java 2008-08-11 08:59:29 UTC (rev 15024)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/onetomany/OneToManyTest.java 2008-08-11 09:14:39 UTC (rev 15025)
@@ -12,9 +12,11 @@
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.dialect.HSQLDialect;
import org.hibernate.test.annotations.Customer;
import org.hibernate.test.annotations.Discount;
import org.hibernate.test.annotations.Passport;
+import org.hibernate.test.annotations.RequiresDialect;
import org.hibernate.test.annotations.TestCase;
import org.hibernate.test.annotations.Ticket;
import org.hibernate.test.annotations.TicketComparator;
@@ -379,6 +381,7 @@
s.close();
}
+ @RequiresDialect(HSQLDialect.class)
public void testOrderByOnSuperclassProperty() {
OrganisationUser user = new OrganisationUser();
user.setFirstName( "Emmanuel" );
Copied: annotations/trunk/src/test-resources/ehcache.xml (from rev 15019, annotations/trunk/src/test/ehcache.xml)
===================================================================
--- annotations/trunk/src/test-resources/ehcache.xml (rev 0)
+++ annotations/trunk/src/test-resources/ehcache.xml 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,80 @@
+<ehcache>
+ <!-- Sets the path to the directory where cache .data files are created.
+ If the path is a Java System Property it is replaced by
+ its value in the running VM.
+
+ The following properties are translated:
+ user.home - User's home directory
+ user.dir - User's current working directory
+ java.io.tmpdir - Default temp file path -->
+
+ <diskStore path="java.io.tmpdir"/>
+ <!--Default Cache configuration. These will applied to caches programmatically created through
+ the CacheManager.
+ The following attributes are required for defaultCache:
+ maxInMemory - Sets the maximum number of objects that will be created in memory
+ eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
+ is never expired.
+ timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
+ if the element is not eternal. Idle time is now - last accessed time
+ timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
+ if the element is not eternal. TTL is now - creation time
+ overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
+ has reached the maxInMemory limit.
+
+ -->
+
+ <defaultCache
+ maxElementsInMemory="10000"
+ eternal="false"
+ timeToIdleSeconds="120"
+ timeToLiveSeconds="120"
+ overflowToDisk="true"
+ />
+ <!--Predefined caches. Add your cache configuration settings here.
+ If you do not have a configuration for your cache a WARNING will be issued when the
+ CacheManager starts
+ The following attributes are required for defaultCache:
+ name - Sets the name of the cache. This is used to identify the cache. It must be unique.
+ maxInMemory - Sets the maximum number of objects that will be created in memory
+ eternal - Sets whether elements are eternal. If eternal, timeouts are ignored and the element
+ is never expired.
+ timeToIdleSeconds - Sets the time to idle for an element before it expires. Is only used
+ if the element is not eternal. Idle time is now - last accessed time
+ timeToLiveSeconds - Sets the time to live for an element before it expires. Is only used
+ if the element is not eternal. TTL is now - creation time
+ overflowToDisk - Sets whether elements can overflow to disk when the in-memory cache
+ has reached the maxInMemory limit.
+ -->
+
+ <!-- Sample cache named sampleCache1
+ This cache contains a maximum in memory of 10000 elements, and will expire
+ an element if it is idle for more than 5 minutes and lives for more than
+ 10 minutes.
+
+ If there are more than 10000 elements it will overflow to the
+ disk cache, which in this configuration will go to wherever java.io.tmp is
+ defined on your system. On a standard Linux system this will be /tmp"
+ -->
+
+ <cache name="sampleCache1"
+ maxElementsInMemory="10000"
+ eternal="false"
+ timeToIdleSeconds="300"
+ timeToLiveSeconds="600"
+ overflowToDisk="true"
+ />
+
+ <!-- Sample cache named sampleCache2
+ This cache contains 1000 elements. Elements will always be held in memory.
+ They are not expired. -->
+ <cache name="sampleCache2"
+ maxElementsInMemory="1000"
+ eternal="true"
+ timeToIdleSeconds="0"
+ timeToLiveSeconds="0"
+ overflowToDisk="false"
+ />
+
+ <!-- Place configuration for your caches following -->
+</ehcache>
\ No newline at end of file
Added: annotations/trunk/src/test-resources/hibernate.properties
===================================================================
--- annotations/trunk/src/test-resources/hibernate.properties (rev 0)
+++ annotations/trunk/src/test-resources/hibernate.properties 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,301 @@
+######################
+### Query Language ###
+######################
+
+## define query language constants / function names
+
+hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
+
+
+## select the classic query parser
+
+#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
+
+hibernate.format_sql true
+
+
+
+#################
+### Platforms ###
+#################
+
+hibernate.dialect @hibernate.dialect@
+hibernate.connection.driver_class @hibernate.connection.driver_class@
+hibernate.connection.username @hibernate.connection.username@
+hibernate.connection.password @hibernate.connection.password@
+hibernate.connection.url @hibernate.connection.url@
+
+#################################
+### Hibernate Connection Pool ###
+#################################
+
+hibernate.connection.pool_size 1
+
+###########################
+### C3P0 Connection Pool###
+###########################
+
+#hibernate.c3p0.max_size 2
+#hibernate.c3p0.min_size 2
+#hibernate.c3p0.timeout 5000
+#hibernate.c3p0.max_statements 100
+#hibernate.c3p0.idle_test_period 3000
+#hibernate.c3p0.acquire_increment 2
+#hibernate.c3p0.validate false
+
+##############################
+### Proxool Connection Pool###
+##############################
+
+## Properties for external configuration of Proxool
+
+hibernate.proxool.pool_alias pool1
+
+## Only need one of the following
+
+#hibernate.proxool.existing_pool true
+#hibernate.proxool.xml proxool.xml
+#hibernate.proxool.properties proxool.properties
+
+
+
+#################################
+### Plugin ConnectionProvider ###
+#################################
+
+## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)
+
+#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
+#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
+#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
+#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
+#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
+
+
+
+#######################
+### Transaction API ###
+#######################
+
+## Enable automatic flush during the JTA beforeCompletion() callback
+## (This setting is relevant with or without the Transaction API)
+
+#hibernate.transaction.flush_before_completion
+
+
+## Enable automatic session close at the end of transaction
+## (This setting is relevant with or without the Transaction API)
+
+#hibernate.transaction.auto_close_session
+
+
+## the Transaction API abstracts application code from the underlying JTA or JDBC transactions
+
+#hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
+#hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory
+
+
+## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
+## default is java:comp/UserTransaction
+## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class
+
+#jta.UserTransaction jta/usertransaction
+#jta.UserTransaction javax.transaction.UserTransaction
+#jta.UserTransaction UserTransaction
+
+
+## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA TransactionManager
+
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup
+#hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup
+
+
+
+##############################
+### Miscellaneous Settings ###
+##############################
+
+## print all generated SQL to the console
+
+#hibernate.show_sql true
+
+
+## add comments to the generated SQL
+
+#hibernate.use_sql_comments true
+
+
+## generate statistics
+
+#hibernate.generate_statistics true
+
+
+## auto schema export
+
+#hibernate.hbm2ddl.auto create-drop
+#hibernate.hbm2ddl.auto create
+#hibernate.hbm2ddl.auto update
+
+
+## specify a default schema and catalog for unqualified tablenames
+
+#hibernate.default_schema test
+#hibernate.default_catalog test
+
+
+## enable ordering of SQL UPDATEs by primary key
+
+hibernate.order_updates true
+
+
+## set the maximum depth of the outer join fetch tree
+
+hibernate.max_fetch_depth 1
+
+
+## set the default batch size for batch fetching
+
+hibernate.default_batch_fetch_size 100
+
+
+## rollback generated identifier values of deleted entities to default values
+
+#hibernate.use_identifer_rollback true
+
+
+## enable CGLIB reflection optimizer (enabled by default)
+
+#hibernate.cglib.use_reflection_optimizer false
+
+
+
+#####################
+### JDBC Settings ###
+#####################
+
+## specify a JDBC isolation level
+
+#hibernate.connection.isolation 4
+
+
+## enable JDBC autocommit (not recommended!)
+
+#hibernate.connection.autocommit true
+
+
+## set the JDBC fetch size
+
+#hibernate.jdbc.fetch_size 25
+
+
+## set the maximum JDBC 2 batch size (a nonzero value enables batching)
+
+#hibernate.jdbc.batch_size 0
+
+
+## enable batch updates even for versioned data
+
+hibernate.jdbc.batch_versioned_data true
+
+
+## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
+
+#hibernate.jdbc.use_scrollable_resultset true
+
+
+## use streams when writing binary types to / from JDBC
+
+hibernate.jdbc.use_streams_for_binary true
+
+
+## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
+
+#hibernate.jdbc.use_get_generated_keys false
+
+
+## choose a custom JDBC batcher
+
+# hibernate.jdbc.factory_class
+
+
+## enable JDBC result set column alias caching
+## (minor performance enhancement for broken JDBC drivers)
+
+# hibernate.jdbc.wrap_result_sets
+
+
+## choose a custom SQL exception converter
+
+#hibernate.jdbc.sql_exception_converter
+
+
+
+##########################
+### Second-level Cache ###
+##########################
+
+## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)
+
+#hibernate.cache.use_minimal_puts true
+
+
+## set a prefix for cache region names
+
+hibernate.cache.region_prefix hibernate.test
+
+
+## disable the second-level cache
+
+#hibernate.cache.use_second_level_cache false
+
+
+## enable the query cache
+
+hibernate.cache.use_query_cache true
+
+
+## store the second-level cache entries in a more human-friendly format
+
+#hibernate.cache.use_structured_entries true
+
+
+## choose a cache implementation
+
+#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
+#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
+hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
+#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
+#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
+#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider
+
+
+## choose a custom query cache implementation
+
+#hibernate.cache.query_cache_factory
+
+
+
+############
+### JNDI ###
+############
+
+## specify a JNDI name for the SessionFactory
+
+#hibernate.session_factory_name hibernate/session_factory
+
+
+## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
+## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
+## is the best approach in an application server
+
+#file system
+#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
+#hibernate.jndi.url file:/
+
+#WebSphere
+#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
+#hibernate.jndi.url iiop://localhost:900/
+
Property changes on: annotations/trunk/src/test-resources/hibernate.properties
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Copied: annotations/trunk/src/test-resources/log4j.properties (from rev 15019, annotations/trunk/src/test/log4j.properties)
===================================================================
--- annotations/trunk/src/test-resources/log4j.properties (rev 0)
+++ annotations/trunk/src/test-resources/log4j.properties 2008-08-11 09:14:39 UTC (rev 15025)
@@ -0,0 +1,51 @@
+### direct log messages to stdout ###
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+
+### direct messages to file hibernate.log ###
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.File=hibernate.log
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+
+### direct messages to socket - chainsaw ###
+log4j.appender.socket=org.apache.log4j.net.SocketAppender
+log4j.appender.socket.remoteHost=localhost
+log4j.appender.socket.port=4560
+log4j.appender.socket.locationInfo=true
+
+
+### set log levels - for more verbose logging change 'info' to 'debug' ###
+
+log4j.rootLogger=warn, stdout
+
+log4j.logger.org.hibernate=debug
+
+
+### log just the SQL
+log4j.logger.org.hibernate.SQL=debug
+
+#log4j.logger.org.hibernate.engine.CascadingAction=debug
+
+### log JDBC bind parameters ###
+log4j.logger.org.hibernate.type=debug
+
+### log schema export/update ###
+log4j.logger.org.hibernate.tool.hbm2ddl=debug
+
+### log cache activity ###
+log4j.logger.org.hibernate.cache=debug
+
+### enable the following line if you want to track down connection ###
+### leakages when using DriverManagerConnectionProvider ###
+#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
+
+### annotation logs
+#log4j.logger.org.hibernate.annotation=info
+#log4j.logger.org.hibernate.cfg=info
+#log4j.logger.org.hibernate.cfg.SettingsFactory=info
+#log4j.logger.org.hibernate.cfg.AnnotationBinder=info
+#log4j.logger.org.hibernate.cfg.AnnotationConfiguration=info
+#log4j.logger.org.hibernate.cfg.Ejb3Column=info
\ No newline at end of file
16 years, 4 months
Hibernate SVN: r15024 - search/trunk/src/test/org/hibernate/search/test/id/providedId.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-08-11 04:59:29 -0400 (Mon, 11 Aug 2008)
New Revision: 15024
Removed:
search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java
Log:
Deleted misnamed test.
Deleted: search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java 2008-08-11 08:54:12 UTC (rev 15023)
+++ search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java 2008-08-11 08:59:29 UTC (rev 15024)
@@ -1,71 +0,0 @@
-package org.hibernate.search.test.id.providedId;
-
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.hibernate.search.test.SearchTestCase;
-import org.hibernate.search.Search;
-import org.hibernate.search.FullTextSession;
-import org.hibernate.search.FullTextQuery;
-import org.apache.lucene.search.Query;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-
-import java.util.List;
-
-/**
- * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
- */
-public class TestProvidedId extends SearchTestCase {
-
- JBossCachePerson person1, person2, person3, person4;
-
- protected Class[] getMappings() {
- return new Class[]{
- JBossCachePerson.class
- };
- }
-
- public void testProvidedId() throws ParseException {
-
- person1 = new JBossCachePerson();
- person1.setName("Navin Surtani");
- person1.setBlurb("Likes playing WoW");
-
- person2 = new JBossCachePerson();
- person2.setName("Big Goat");
- person2.setBlurb("Eats grass");
-
- person3 = new JBossCachePerson();
- person3.setName("Mini Goat");
- person3.setBlurb("Eats cheese");
-
- person4 = new JBossCachePerson();
- person4.setName("Smelly Cat");
- person4.setBlurb("Eats fish");
-
-
- Session session = openSession();
- FullTextSession fullTextSession = Search.getFullTextSession(session);
- Transaction transaction = fullTextSession.beginTransaction();
- session.save(person1);
- session.save(person2);
- session.save(person3);
- session.save(person4);
-
- QueryParser parser = new QueryParser("Name", new StandardAnalyzer());
- Query luceneQuery = parser.parse("Goat");
-
- FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery, JBossCachePerson.class);
-
-
- List results = fullTextQuery.list();
-
- transaction.commit();
- session.close();
-
- System.out.println("result size is " + results.size());
- }
-
-
-}
16 years, 4 months
Hibernate SVN: r15023 - in commons-annotations/trunk: lib/build and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-08-11 04:54:12 -0400 (Mon, 11 Aug 2008)
New Revision: 15023
Added:
commons-annotations/trunk/lib/build/ant-contrib-1.0b2.jar
Modified:
commons-annotations/trunk/build.xml
commons-annotations/trunk/common-build.xml
Log:
Refactored the build files and updated common-build.xml. Also introduced the new ant extension ant-contrib.
Modified: commons-annotations/trunk/build.xml
===================================================================
--- commons-annotations/trunk/build.xml 2008-08-11 08:15:16 UTC (rev 15022)
+++ commons-annotations/trunk/build.xml 2008-08-11 08:54:12 UTC (rev 15023)
@@ -30,21 +30,11 @@
<path id="junit.moduleclasspath">
<pathelement location="${src.dir}"/>
<pathelement location="${test.dir}"/>
- <!-- pathelement location="${jpa-api.jar}"/ -->
<fileset dir="${ivy.dep.dir}/test">
<include name="*.jar"/>
</fileset>
</path>
- <!-- ivy load -->
- <property name="ivy.jar.dir" value="${basedir}/ivy" />
- <property name="ivy.conf.dir" value="${basedir}" />
- <path id="ivy.lib.path">
- <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
- </path>
- <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
- uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
-
<target name="init" description="Initialize the build">
<!-- CCed from common-build to avoid failure when hibernate core is not compiled -->
<tstamp>
@@ -73,20 +63,19 @@
<ivy:configure file="${ivy.jar.dir}/ivyconf.xml" />
</target>
- <target name="get.deps.core" depends="init" description="retrieve the core dependencies">
- <ivy:resolve conf="default" />
- <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]" conf="default" />
- </target>
+ <target name="compile" depends="init,get.deps.core"
+ description="Compile the Java source code">
+ <available classname="org.eclipse.core.launcher.Main"
+ property="build.compiler"
+ value="org.eclipse.jdt.core.JDTCompilerAdapter"
+ classpath="${java.class.path}"/>
+ <javac target="${javac.target}" source="${javac.source}"
+ srcdir="${src.dir}" destdir="${classes.dir}"
+ classpathref="lib.class.path" debug="${javac.debug}"
+ optimize="${javac.optimize}" nowarn="on">
+ </javac>
+ </target>
- <target name="compile" depends="get.deps.core">
- <antcall target="common-build.compile"/>
- </target>
-
- <target name="get.deps.test" depends="init" description="retrieve the test dependencies">
- <ivy:resolve conf="test" />
- <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test" />
- </target>
-
<target name="compiletest" depends="compile,get.deps.test" description="Compile the tests">
<available
classname="org.eclipse.core.launcher.Main"
@@ -124,7 +113,30 @@
status="integration"
/>
</target>
+
+ <target name="junit" depends="compiletest">
+ <mkdir dir="${testreports.dir}"/>
+ <junit printsummary="yes" haltonfailure="yes" forkmode="once">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest fork="yes" todir="${testreports.dir}" haltonfailure="no">
+ <fileset refid="junit.batchtestset"/>
+ </batchtest>
+ </junit>
+ </target>
+ <!-- Run a single unit test. -->
+ <target name="junitsingle" depends="compiletest" description="Run a single test suite (requires testname and jdbc.driver properties)">
+ <mkdir dir="${testreports.dir}"/>
+ <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <test fork="yes" todir="${testreports.dir}" haltonfailure="no" name="${testname}"/>
+ </junit>
+ </target>
+
<!-- Some of this can probably be moved to common-build... -->
<target name="dist" depends="jar,get.deps.core,get.deps.test,javadoc,copysource,copytest,copylib,extras" description="Build everything">
Modified: commons-annotations/trunk/common-build.xml
===================================================================
--- commons-annotations/trunk/common-build.xml 2008-08-11 08:15:16 UTC (rev 15022)
+++ commons-annotations/trunk/common-build.xml 2008-08-11 08:54:12 UTC (rev 15023)
@@ -1,277 +1,248 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project name="common-build" default="dist"
- xmlns:artifact="urn:maven-artifact-ant">
- <description>Common properties and targets for the HibernateExt project</description>
-
- <!-- my.basedir property can be used to refer to files/directories relatively to the common-build.xml file -->
- <dirname property="common-build.basedir" file="${ant.file.common-build}"/>
-
- <!-- Give user a chance to override without editing this file
- (and without typing -D each time it compiles it) -->
- <property file="${common-build.basedir}/build.properties"/>
- <property file="${user.home}/.ant.properties"/>
-
- <property name="src.dir" location="src/java"/>
- <property name="test.dir" location="src/test"/>
- <property name="lib.dir" location="lib"/>
- <property name="build.dir" location="build"/>
- <property name="classes.dir" location="${build.dir}/classes"/>
- <property name="testclasses.dir" location="${build.dir}/testclasses"/>
- <property name="testreports.dir" location="${build.dir}/test-reports"/>
- <property name="dist.target.dir" location="target"/>
- <property name="dist.dir" location="${dist.target.dir}/${name}"/>
- <property name="instrumenttest.out.dir" value="instrumenttestout"/>
- <property name="doc.dir" location="doc"/>
- <property name="doc.api.dir" location="${doc.dir}/api"/>
- <property name="doc.reference.dir" location="${doc.dir}/reference"/>
-
- <property name="dist.doc.dir" location="${dist.dir}/doc"/>
- <property name="dist.api.dir" location="${dist.dir}/doc/api"/>
-
- <property name="dist.src.dir" location="${dist.dir}/src"/>
- <property name="dist.test.dir" location="${dist.dir}/test"/>
- <property name="dist.lib.dir" location="${dist.dir}/lib"/>
- <property name="jar.name" value="${name}"/>
- <property name="jar.file.name" value="${dist.dir}/${jar.name}.jar"/>
- <property name="jartest.file.name" value="${dist.dir}/${jar.name}-tests.jar"/>
-
- <property name="javadoc" value="http://java.sun.com/j2se/1.4/docs/api"/>
- <property name="javac.debug" value="on"/>
- <property name="javac.optimize" value="off"/>
- <property name="javac.source" value="1.4"/>
- <property name="javac.target" value="1.4"/>
-
- <property name="pom.file" value="pom.xml"/>
- <property name="src.jar" value="${build.dir}/src.jar"/>
-
+<project name="common-build" default="dist"
+ xmlns:artifact="urn:maven-artifact-ant" xmlns:ivy="antlib:fr.jayasoft.ivy.ant">
+ <description>Common properties and targets for the HibernateExt
+ project</description>
+
+
+ <!-- my.basedir property can be used to refer to files/directories relatively to the common-build.xml file -->
+ <dirname property="common-build.basedir" file="${ant.file.common-build}"/>
+
+ <!-- Give user a chance to override without editing this file
+ (and without typing -D each time it compiles it) -->
+ <property file="${common-build.basedir}/build.properties"/>
+ <property file="${user.home}/.ant.properties"/>
+
+ <property name="src.dir" location="src/java"/>
+ <property name="test.dir" location="src/test"/>
+ <property name="test.resources.dir" location="src/test-resources"/>
+ <property name="filter.dir" location="src/filters"/>
+ <property name="lib.dir" location="lib"/>
+ <property name="build.dir" location="build"/>
+ <property name="classes.dir" location="${build.dir}/classes"/>
+ <property name="testclasses.dir" location="${build.dir}/testclasses"/>
+ <property name="testreports.dir" location="${build.dir}/test-reports"/>
+ <property name="dist.target.dir" location="target"/>
+ <property name="dist.dir" location="${dist.target.dir}/${name}"/>
+ <property name="instrumenttest.out.dir" value="${build.dir}/test-reports/instrument"/>
+ <property name="doc.dir" location="doc"/>
+ <property name="doc.api.dir" location="${doc.dir}/api"/>
+ <property name="doc.reference.dir" location="${doc.dir}/reference"/>
+
+ <property name="dist.doc.dir" location="${dist.dir}/doc"/>
+ <property name="dist.api.dir" location="${dist.dir}/doc/api"/>
+
+ <property name="dist.src.dir" location="${dist.dir}/src"/>
+ <property name="dist.test.dir" location="${dist.dir}/test"/>
+ <property name="dist.lib.dir" location="${dist.dir}/lib"/>
+ <property name="jar.name" value="${name}"/>
+ <property name="jar.file.name" value="${dist.dir}/${jar.name}.jar"/>
+ <property name="jartest.file.name" value="${dist.dir}/${jar.name}-tests.jar"/>
+
+ <property name="javadoc" value="http://java.sun.com/j2se/1.4/docs/api"/>
+ <property name="javac.debug" value="on"/>
+ <property name="javac.optimize" value="off"/>
+ <property name="javac.source" value="1.4"/>
+ <property name="javac.target" value="1.4"/>
+
+ <property name="pom.file" value="pom.xml"/>
+ <property name="src.jar" value="${build.dir}/src.jar"/>
+
<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
- <fileset dir="${common-build.basedir}/lib/build"><!-- ${build.lib.dir} fails in reference doc build -->
+ <fileset dir="${common-build.basedir}/lib/build">
+ <!-- ${build.lib.dir} fails in reference doc build -->
<include name="junit-*.jar"/>
<include name="ant-junit-*.jar"/>
</fileset>
</classpath>
- </taskdef>
-
- <taskdef name="junitreport" classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
+ </taskdef>
+
+ <taskdef name="junitreport"
+ classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
<classpath>
- <fileset dir="${common-build.basedir}/lib/build"><!-- ${build.lib.dir} fails in reference doc build -->
+ <fileset dir="${common-build.basedir}/lib/build">
+ <!-- ${build.lib.dir} fails in reference doc build -->
<include name="junit-*.jar"/>
<include name="ant-junit-*.jar"/>
</fileset>
- </classpath>
- </taskdef>
-
- <!-- ivy load -->
- <property name="ivy.jar.dir" value="${common-build.basedir}/ivy" />
- <property name="ivy.conf.dir" value="${common-build.basedir}" />
- <path id="ivy.lib.path">
- <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
- </path>
- <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
- uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
-
- <!-- maven task load -->
- <path id="maven-ant-tasks.path" path="${ivy.jar.dir}/maven-ant-tasks.jar" />
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
- uri="urn:maven-artifact-ant"
- classpathref="maven-ant-tasks.path" />
-
- <artifact:remoteRepository id="offline.repository.jboss.org" url="file://${offline.repository.jboss.org}" />
-
- <path id="lib.class.path">
- <path refid="lib.moduleclass.path"/>
- <pathelement path="${clover.jar}"/>
- </path>
-
- <!-- overridable in modules -->
- <path id="lib.moduleclass.path"/>
-
- <patternset id="support.files">
- <include name="**/*.jpg"/>
- <include name="**/*.gif"/>
- <include name="**/*.dtd"/>
- <include name="**/*.xsd"/>
- <include name="**/*.xml"/>
- <include name="**/*.xslt"/>
-
- <!-- exclude everything we don't want in the jar -->
- <exclude name="${build.dir}/**/*"/>
- <exclude name="${doc.dir}/**/*"/>
- <exclude name="classes/**/*"/>
- <exclude name="build.xml"/>
- <exclude name="**/*.properties"/>
- <exclude name="**/*.ccf"/>
- <exclude name="**/*.cfg.xml"/>
- <exclude name="**/ehcache.xml"/>
- </patternset>
-
- <patternset id="source.files">
- <include name="**/*.java"/>
- <include name="**/*.properties"/>
- </patternset>
-
- <!-- junit paths/filesets -->
- <fileset dir="${testclasses.dir}" id="junit.batchtestset">
- <include name="**/*Test.class"/>
- </fileset>
-
- <path id="testsrc.path">
- <pathelement location="${test.dir}"/>
- </path>
-
- <!-- Clover -->
- <property name="clover.out.dir" value="cloverout"/>
- <property name="clover.jar" value="${ant.home}/lib/clover.jar"/>
- <taskdef resource="clovertasks"/>
-
- <path id="junit.classpath">
- <pathelement path="${classes.dir}"/>
- <pathelement path="${testclasses.dir}"/>
- <path refid="lib.class.path"/>
- <path refid="junit.moduleclasspath"/>
- <path location="${clover.jar}"/>
- </path>
-
- <!-- Clover tasks -->
- <target name="with.clover">
- <clover-setup initString="clover_coverage.db"/>
- </target>
-
- <target name="cloverreport.html" depends="with.clover"
- description="Generate a clover report from the current clover database.">
- <clover-report>
- <current outfile="${clover.out.dir}">
- <format type="html"/>
- </current>
- </clover-report>
- </target>
-
- <target name="cloverreport" depends="with.clover,junitreport,cloverreport.html"
- description="Run the tests and generate a clover report">
- </target>
-
- <!-- Tasks -->
-
- <target name="clean" description="Cleans up build and dist directories">
- <delete dir="${build.dir}"/>
- <delete dir="${dist.target.dir}"/>
- <delete dir="${clover.out.dir}"/>
- </target>
-
- <target name="init" description="Initialize the build">
- <tstamp>
- <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/>
- </tstamp>
- <echo message="Build ${Name}-${version} (${subversion})"/>
- <mkdir dir="${classes.dir}"/>
- <mkdir dir="${testclasses.dir}"/>
- <copy todir="${classes.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
-
- <copy todir="${build.dir}">
- <fileset dir=".">
- <include name="readme.txt"/>
- <include name="lgpl.txt"/>
- </fileset>
- </copy>
- </target>
-
- <target name="compile" depends="init" description="Compile the Java source code">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- target="${javac.target}"
- source="${javac.source}"
- srcdir="${src.dir}"
- destdir="${classes.dir}"
- classpathref="lib.class.path"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on">
- </javac>
- </target>
-
- <target name="compiletest" depends="compile" description="Compile the tests">
- <available
- classname="org.eclipse.core.launcher.Main"
- property="build.compiler"
- value="org.eclipse.jdt.core.JDTCompilerAdapter"
- classpath="${java.class.path}"/>
- <javac
- target="${javac.target}"
- source="${javac.source}"
- destdir="${testclasses.dir}"
- classpathref="junit.classpath"
- debug="${javac.debug}"
- optimize="${javac.optimize}"
- nowarn="on">
- <src refid="testsrc.path"/>
- </javac>
+ </classpath>
+ </taskdef>
+
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath>
+ <fileset dir="${common-build.basedir}/lib/build">
+ <!-- ${build.lib.dir} fails in reference doc build -->
+ <include name="ant-contrib-*.jar"/>
+ </fileset>
+ </classpath>
+ </taskdef>
+
+ <!-- ivy load -->
+ <property name="ivy.jar.dir" value="${common-build.basedir}/ivy"/>
+ <property name="ivy.conf.dir" value="${common-build.basedir}"/>
+ <path id="ivy.lib.path">
+ <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
+ </path>
+ <taskdef resource="fr/jayasoft/ivy/ant/antlib.xml"
+ uri="antlib:fr.jayasoft.ivy.ant" classpathref="ivy.lib.path"/>
+
+ <!-- maven task load -->
+ <path id="maven-ant-tasks.path" path="${ivy.jar.dir}/maven-ant-tasks.jar"/>
+ <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
+ uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.path"/>
+
+ <artifact:remoteRepository id="offline.repository.jboss.org"
+ url="file://${offline.repository.jboss.org}"/>
+
+ <path id="lib.class.path">
+ <path refid="lib.moduleclass.path"/>
+ <pathelement path="${clover.jar}"/>
+ </path>
+
+ <!-- overridable in modules -->
+ <path id="lib.moduleclass.path"/>
+
+ <patternset id="support.files">
+ <include name="**/*.jpg"/>
+ <include name="**/*.gif"/>
+ <include name="**/*.dtd"/>
+ <include name="**/*.xsd"/>
+ <include name="**/*.xml"/>
+ <include name="**/*.xslt"/>
+
+ <!-- exclude everything we don't want in the jar -->
+ <exclude name="${build.dir}/**/*"/>
+ <exclude name="${doc.dir}/**/*"/>
+ <exclude name="classes/**/*"/>
+ <exclude name="build.xml"/>
+ <exclude name="**/*.properties"/>
+ <exclude name="**/*.ccf"/>
+ <exclude name="**/*.cfg.xml"/>
+ <exclude name="**/ehcache.xml"/>
+ </patternset>
+
+ <patternset id="source.files">
+ <include name="**/*.java"/>
+ <include name="**/*.properties"/>
+ </patternset>
+
+ <!-- junit paths/filesets -->
+ <fileset dir="${testclasses.dir}" id="junit.batchtestset">
+ <include name="**/*Test.class"/>
+ </fileset>
+
+ <path id="testsrc.path">
+ <pathelement location="${test.dir}"/>
+ </path>
+
+ <path id="junit.classpath">
+ <pathelement path="${classes.dir}"/>
+ <pathelement path="${testclasses.dir}"/>
+ <path refid="lib.class.path"/>
+ <path refid="junit.moduleclasspath"/>
+ <path location="${clover.jar}"/>
+ </path>
+
+ <!-- Determine the database against which to run tests-->
+ <if>
+ <equals arg1="${targetdb}" arg2="$${targetdb}"/>
+ <then>
+ <echo message="No target database specified using default HSQLDB"/>
+ <property name="targetdb" value="hsqldb"/>
+ </then>
+ </if>
+
+ <!-- Clover tasks -->
+ <target name="with.clover">
+ <clover-setup initString="clover_coverage.db"/>
+ </target>
+
+ <target name="cloverreport.html" depends="with.clover"
+ description="Generate a clover report from the current clover database.">
+ <clover-report>
+ <current outfile="${clover.out.dir}">
+ <format type="html"/>
+ </current>
+ </clover-report>
+ </target>
+
+ <target name="cloverreport"
+ depends="with.clover,junitreport,cloverreport.html"
+ description="Run the tests and generate a clover report">
+ </target>
+
+ <!-- Tasks -->
+ <target name="clean" description="Cleans up build and dist directories">
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.target.dir}"/>
+ <delete dir="${clover.out.dir}"/>
+ </target>
+
+ <target name="init" description="Initialize the build">
+ <tstamp>
+ <format property="subversion" pattern="yyyy-MM-dd hh:mm:ss"/>
+ </tstamp>
+ <echo message="Build ${Name}-${version} (${subversion})"/>
+ <mkdir dir="${classes.dir}"/>
+ <mkdir dir="${testclasses.dir}"/>
+ <copy todir="${classes.dir}">
+ <fileset dir="${src.dir}">
+ <patternset refid="support.files"/>
+ </fileset>
+ </copy>
+
+ <copy todir="${build.dir}">
+ <fileset dir=".">
+ <include name="readme.txt"/>
+ <include name="lgpl.txt"/>
+ </fileset>
+ </copy>
</target>
-
- <target name="instrument" depends="compiletest"
- description="Instrument the persistent classes"> <!-- depends="jar" -->
-
- <taskdef name="instrument" classname="org.hibernate.tool.instrument.InstrumentTask">
- <classpath path="${classes.dir}"/>
- <classpath path="${testclasses.dir}"/>
- <classpath refid="lib.class.path"/>
- </taskdef>
-
- <instrument verbose="true">
- <fileset dir="${testclasses.dir}/org/hibernate/test">
- <include name="**/*.class"/>
- <exclude name="**/*Test$*.class"/>
- <exclude name="**/*Test.class"/>
- <exclude name="**/*Tests.class"/>
- </fileset>
- </instrument>
-
- <!-- jar jarfile="${build.dir}/instrumented-classes.jar">
- <fileset dir="${testclasses.dir}">
- <include name="org/hibernate/test/**/*.class"/>
- <exclude name="org/hibernate/test/**/*Test.class"/>
- </fileset>
- </jar -->
-
- </target>
-
- <target name="copytest" description="Copy tests to dist dir" if="copy.test" >
- <mkdir dir="${dist.test.dir}"/>
- <copy todir="${dist.test.dir}">
- <fileset dir="${test.dir}"/>
- </copy>
- </target>
-
- <target name="copysource" depends="copytest" description="Copy sources to dist dir">
- <mkdir dir="${dist.src.dir}"/>
- <copy todir="${dist.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="source.files"/>
- </fileset>
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- <mkdir dir="${dist.src.dir}"/>
- <copy todir="${dist.src.dir}">
- <fileset dir="${src.dir}">
- <patternset refid="source.files"/>
- </fileset>
- <fileset dir="${src.dir}">
- <patternset refid="support.files"/>
- </fileset>
- </copy>
- </target>
+ <target name="get.deps.core" depends="init"
+ description="retrieve the core dependencies">
+ <ivy:resolve conf="default"/>
+ <ivy:retrieve pattern="${ivy.dep.dir}/core/[artifact].[ext]"
+ conf="default"/>
+ </target>
+
+ <target name="get.deps.test" depends="init"
+ description="retrieve the test dependencies">
+ <ivy:resolve conf="test"/>
+ <ivy:retrieve pattern="${ivy.dep.dir}/test/[artifact].[ext]" conf="test"/>
+ </target>
+
+ <target name="copytest" description="Copy tests to dist dir" if="copy.test">
+ <mkdir dir="${dist.test.dir}"/>
+ <copy todir="${dist.test.dir}">
+ <fileset dir="${test.dir}"/>
+ </copy>
+ </target>
+
+ <target name="copysource" depends="copytest"
+ description="Copy sources to dist dir">
+ <mkdir dir="${dist.src.dir}"/>
+ <copy todir="${dist.src.dir}">
+ <fileset dir="${src.dir}">
+ <patternset refid="source.files"/>
+ </fileset>
+ <fileset dir="${src.dir}">
+ <patternset refid="support.files"/>
+ </fileset>
+ </copy>
+ <mkdir dir="${dist.src.dir}"/>
+ <copy todir="${dist.src.dir}">
+ <fileset dir="${src.dir}">
+ <patternset refid="source.files"/>
+ </fileset>
+ <fileset dir="${src.dir}">
+ <patternset refid="support.files"/>
+ </fileset>
+ </copy>
+ </target>
+
<target name="copylib" description="Copy jars to lib dir">
<mkdir dir="${dist.lib.dir}"/>
<copy todir="${dist.lib.dir}" verbose="true">
@@ -283,194 +254,197 @@
</fileset>
</copy>
</target>
+
+ <target name="copydoc" description="Copy doc to dist dir" if="copy.doc">
+ <mkdir dir="${dist.doc.dir}"/>
+ <copy todir="${dist.doc.dir}">
+ <fileset dir="${doc.dir}">
+ <include name="**/*.html"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="jar" depends="compile"
+ description="Build the distribution .jar file">
+ <mkdir dir="${dist.dir}"/>
+ <jar filesetmanifest="merge" jarfile="${jar.file.name}"
+ basedir="${classes.dir}"/>
+ </target>
+
+ <target name="jartest" depends="compiletest"
+ description="Build the distribution .jar file">
+ <mkdir dir="${dist.dir}"/>
+ <jar filesetmanifest="merge" jarfile="${jartest.file.name}"
+ basedir="${testclasses.dir}"/>
+ </target>
+
+ <!-- DOCUMENTATION -->
+
+ <target name="javadoc"
+ description="Compile the Javadoc API documentation to dist dir">
+ <mkdir dir="${dist.api.dir}"/>
+ <javadoc packagenames="${javadoc.packagenames}"
+ classpathref="lib.class.path" destdir="${dist.api.dir}" use="true"
+ protected="true" version="true"
+ windowtitle="${Name} API Documentation"
+ Overview="${doc.api.dir}/package.html"
+ doctitle="${Name} API Documentation"
+ stylesheetfile="${doc.api.dir}/jdstyle.css" link="${javadoc}">
+ <packageset dir="${src.dir}" defaultexcludes="yes">
+ <include name="**/*"/>
+ </packageset>
+ </javadoc>
+ </target>
+
+ <target name="extras" description="Copies miscellaneous files to root dir">
+ <copy todir="${dist.dir}/bin" failonerror="false">
+ <fileset dir="bin">
+ <include name="*.bat"/>
+ </fileset>
+ </copy>
+ <copy file="readme.txt" todir="${dist.dir}"/>
+ <copy file="lgpl.txt" todir="${dist.dir}"/>
+ <copy file="changelog.txt" todir="${dist.dir}"/>
+ <copy file="build.xml" todir="${dist.dir}"/>
+ <replace file="${dist.dir}/build.xml">
+ <replacetoken><![CDATA[../${name}-${version}]]>
+ </replacetoken>
+ <replacevalue><![CDATA[../${name}]]>
+ </replacevalue>
+ </replace>
+ </target>
+
+ <target name="dist" depends="jar,javadoc,copysource,copydoc,extras"
+ description="Build everything">
+ <zip zipfile="${dist.dir}-${version}.zip">
+ <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
+ </zip>
+ <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
+ <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
+ </tar>
+ </target>
+
+ <target name="info" description="Echoes useful system properties">
+ <echo message="java.vm.info=${java.vm.info}"/>
+ <echo message="java.vm.name=${java.vm.name}"/>
+ <echo message="java.vm.vendor=${java.vm.vendor}"/>
+ <echo message="java.vm.version=${java.vm.version}"/>
+ <echo message="os.arch=${os.arch}"/>
+ <echo message="os.name=${os.name}"/>
+ <echo message="os.version=${os.version}"/>
+ <echo message="java.home = ${java.home}"/>
+ <echo message="java.class.path = ${java.class.path}"/>
+ <echo message="build.compiler = ${build.compiler}"/>
+ <echo message="file.encoding=${file.encoding}"/>
+ <echo message="user.home = ${user.home}"/>
+ <echo message="user.language=${user.language}"/>
+ </target>
+
+ <target name="test-resources" description="Copies and filters test resources">
+ <filter filtersfile="${filter.dir}/${db}.filter"/>
+ <mkdir dir="${testclasses.dir}"/>
+ <copy todir="${testclasses.dir}" filtering="true" overwrite="true">
+ <fileset dir="${test.resources.dir}">
+ <include name="*.properties"/>
+ <include name="*.xml"/>
+ </fileset>
+ </copy>
+ </target>
- <target name="copydoc" description="Copy doc to dist dir" if="copy.doc">
- <mkdir dir="${dist.doc.dir}"/>
- <copy todir="${dist.doc.dir}">
- <fileset dir="${doc.dir}">
- <include name="**/*.html"/>
- </fileset>
- </copy>
- </target>
-
- <target name="jar" depends="compile" description="Build the distribution .jar file">
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jar.file.name}" basedir="${classes.dir}"/>
- </target>
-
- <target name="jartest" depends="compiletest" description="Build the distribution .jar file">
- <mkdir dir="${dist.dir}"/>
- <jar filesetmanifest="merge" jarfile="${jartest.file.name}" basedir="${testclasses.dir}"/>
- </target>
-
- <!-- DOCUMENTATION -->
-
- <target name="javadoc" description="Compile the Javadoc API documentation to dist dir">
- <mkdir dir="${dist.api.dir}"/>
- <javadoc
- packagenames="${javadoc.packagenames}"
- classpathref="lib.class.path"
- destdir="${dist.api.dir}"
- use="true"
- protected="true"
- version="true"
- windowtitle="${Name} API Documentation"
- Overview="${doc.api.dir}/package.html"
- doctitle="${Name} API Documentation"
- stylesheetfile="${doc.api.dir}/jdstyle.css"
- link="${javadoc}">
- <packageset dir="${src.dir}" defaultexcludes="yes" >
- <include name="**/*" />
- </packageset>
- </javadoc>
-
-
- </target>
-
-
- <target name="extras" description="Copies miscellaneous files to root dir">
- <copy todir="${dist.dir}/bin" failonerror="false">
- <fileset dir="bin">
- <include name="*.bat"/>
- </fileset>
- </copy>
- <copy file="readme.txt" todir="${dist.dir}"/>
- <copy file="lgpl.txt" todir="${dist.dir}"/>
- <copy file="changelog.txt" todir="${dist.dir}"/>
- <copy file="build.xml" todir="${dist.dir}"/>
- <replace file="${dist.dir}/build.xml">
- <replacetoken><![CDATA[../${name}-${version}]]></replacetoken>
- <replacevalue><![CDATA[../${name}]]></replacevalue>
- </replace>
- </target>
-
- <target name="dist" depends="jar,javadoc,copysource,copydoc,extras" description="Build everything">
- <zip zipfile = "${dist.dir}-${version}.zip">
- <zipfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </zip>
- <tar compression="gzip" tarfile="${dist.dir}-${version}.tar.gz">
- <tarfileset prefix="${name}-${version}" dir="${dist.dir}"/>
- </tar>
- </target>
-
- <target name="info" description="Echoes useful system properties">
- <echo message="java.vm.info=${java.vm.info}"/>
- <echo message="java.vm.name=${java.vm.name}"/>
- <echo message="java.vm.vendor=${java.vm.vendor}"/>
- <echo message="java.vm.version=${java.vm.version}"/>
- <echo message="os.arch=${os.arch}"/>
- <echo message="os.name=${os.name}"/>
- <echo message="os.version=${os.version}"/>
- <echo message="java.home = ${java.home}"/>
- <echo message="java.class.path = ${java.class.path}"/>
- <echo message="build.compiler = ${build.compiler}"/>
- <echo message="file.encoding=${file.encoding}"/>
- <echo message="user.home = ${user.home}"/>
- <echo message="user.language=${user.language}"/>
- </target>
-
- <target name="junit" depends="compiletest">
- <mkdir dir="${testreports.dir}"/>
- <junit printsummary="yes" haltonfailure="yes" forkmode="once">
- <classpath refid="junit.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest fork="yes" todir="${testreports.dir}" haltonfailure="no">
- <fileset refid="junit.batchtestset"/>
- </batchtest>
- </junit>
- </target>
-
- <!-- Run a single unit test. -->
- <target name="junitsingle" depends="compiletest" description="Run a single test suite (requires testname and jdbc.driver properties)">
- <mkdir dir="${testreports.dir}"/>
- <junit printsummary="yes" fork="yes" haltonfailure="yes">
+ <target name="instrument" depends="compiletest"
+ description="Instrument the persistent classes"> <!-- depends="jar" -->
+
+ <taskdef name="instrument"
+ classname="org.hibernate.tool.instrument.javassist.InstrumentTask">
<classpath refid="junit.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <test fork="yes" todir="${testreports.dir}" haltonfailure="no" name="${testname}"/>
- </junit>
- </target>
-
- <target name="junitinstrument" depends="compiletest,instrument"
- description="Run the instrument test suite (requires driver.jar property)">
- <mkdir dir="${instrumenttest.out.dir}"/>
- <junit printsummary="yes" haltonfailure="yes" dir="${basedir}"
- maxmemory="256M" fork="yes" forkmode="perBatch">
- <classpath refid="junit.classpath"/>
- <formatter type="plain"/>
- <formatter type="xml"/>
- <batchtest todir="${instrumenttest.out.dir}" haltonfailure="no">
- <fileset dir="${classes.dir}">
- <include name="org/hibernate/test/**/*Test.class"/>
- </fileset>
- </batchtest>
- </junit>
- </target>
-
- <target name="junitreport" depends="">
- <junitreport todir="${testreports.dir}">
- <fileset dir="${testreports.dir}">
- <include name="TEST-*.xml"/>
- </fileset>
- <report format="frames" todir="${testreports.dir}"/>
- </junitreport>
- </target>
-
- <target name="run" depends="compile" description="Run Hibernate Console">
- <java classname="org.hibernate.console.Start" classpathref="lib.class.path" fork="true">
- <classpath>
- <path location="${build.dir}"/>
- </classpath>
- </java>
- </target>
-
-
- <target name="checkstyle" description="Check coding style">
- <taskdef resource="checkstyletask.properties">
- <classpath>
- <path refid="lib.class.path"/>
- <fileset dir="${common-build.basedir}/lib">
- <include name="checkstyle*.jar"/>
- </fileset>
- </classpath>
- </taskdef>
-
- <checkstyle config="${common-build.basedir}/checkstyle_checks.xml">
- <fileset dir="${src.dir}">
- <include name="**/*.java"/>
+ </taskdef>
+
+ <instrument verbose="true">
+ <fileset dir="${testclasses.dir}/org/hibernate/test">
+ <include name="**/*.class"/>
+ <exclude name="**/*Test$*.class"/>
+ <exclude name="**/*Test.class"/>
+ <exclude name="**/*Tests.class"/>
</fileset>
- <formatter type="plain"/>
- </checkstyle>
- </target>
-
- <target name="patch" depends="checkstyle"
- description="Create a patch">
- <cvs command="-q diff -u -N" output="patch.txt"/>
- </target>
-
- <!-- maven deploy: to be used by the subbuild and delcare deps on jar -->
- <target name="deploy" depends="jar">
- <fail unless="offline.repository.jboss.org" message="offline.repository.jboss.org must be defined"/>
- <jar jarfile="${src.jar}" basedir="${src.dir}">
- <include name="**/*.java" />
- <exclude name="**/test/*.java" />
- <!-- patternset refid="meta.files" / -->
- </jar>
-
- <artifact:pom id="maven.project" file="${pom.file}" />
-
- <artifact:install file="${jar.file.name}">
- <pom refid="maven.project"/>
- </artifact:install>
-
- <artifact:deploy file="${jar.file.name}">
- <pom refid="maven.project" />
- <remoteRepository refId="offline.repository.jboss.org">
- </remoteRepository>
- <attach file="${src.jar}" classifier="sources" />
- <attach file="${jar.file.name}" classifier="" />
- </artifact:deploy>
- </target>
-
+ </instrument>
+ </target>
+
+ <target name="junitinstrument" depends="compiletest,instrument"
+ description="Run the instrument test suite">
+ <for list="${targetdb}" param="db">
+ <sequential>
+ <antcall target="test-resources">
+ <param name="db" value="@{db}"/>
+ </antcall>
+ <mkdir dir="${instrumenttest.out.dir}/@{db}"/>
+ <echo>Running against db: @{db}</echo>
+ <junit printsummary="yes" haltonfailure="yes" dir="${basedir}"
+ maxmemory="256M" fork="yes" forkmode="perBatch">
+ <classpath refid="junit.classpath"/>
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+ <batchtest todir="${instrumenttest.out.dir}/@{db}" haltonfailure="no">
+ <fileset refid="junit.batchtestset"/>
+ </batchtest>
+ </junit>
+ </sequential>
+ </for>
+ </target>
+
+ <target name="junitreport" depends="">
+ <junitreport todir="${testreports.dir}">
+ <fileset dir="${testreports.dir}">
+ <include name="TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${testreports.dir}"/>
+ </junitreport>
+ </target>
+
+ <target name="checkstyle" description="Check coding style">
+ <taskdef resource="checkstyletask.properties">
+ <classpath>
+ <path refid="lib.class.path"/>
+ <fileset dir="${common-build.basedir}/lib">
+ <include name="checkstyle*.jar"/>
+ </fileset>
+ </classpath>
+ </taskdef>
+
+ <checkstyle config="${common-build.basedir}/checkstyle_checks.xml">
+ <fileset dir="${src.dir}">
+ <include name="**/*.java"/>
+ </fileset>
+ <formatter type="plain"/>
+ </checkstyle>
+ </target>
+
+ <target name="patch" depends="checkstyle" description="Create a patch">
+ <cvs command="-q diff -u -N" output="patch.txt"/>
+ </target>
+
+ <!-- maven deploy: to be used by the subbuild and delcare deps on jar -->
+ <target name="deploy" depends="jar">
+ <fail unless="offline.repository.jboss.org"
+ message="offline.repository.jboss.org must be defined"/>
+ <jar jarfile="${src.jar}" basedir="${src.dir}">
+ <include name="**/*.java"/>
+ <exclude name="**/test/*.java"/>
+ <!-- patternset refid="meta.files" / -->
+ </jar>
+
+ <artifact:pom id="maven.project" file="${pom.file}"/>
+
+ <artifact:install file="${jar.file.name}">
+ <pom refid="maven.project"/>
+ </artifact:install>
+
+ <artifact:deploy file="${jar.file.name}">
+ <pom refid="maven.project"/>
+ <remoteRepository refId="offline.repository.jboss.org">
+ </remoteRepository>
+ <attach file="${src.jar}" classifier="sources"/>
+ <attach file="${jar.file.name}" classifier=""/>
+ </artifact:deploy>
+ </target>
+
</project>
\ No newline at end of file
Added: commons-annotations/trunk/lib/build/ant-contrib-1.0b2.jar
===================================================================
(Binary files differ)
Property changes on: commons-annotations/trunk/lib/build/ant-contrib-1.0b2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 4 months
Hibernate SVN: r15022 - search/trunk/src/test/org/hibernate/search/test/id/providedId.
by hibernate-commits@lists.jboss.org
Author: navssurtani
Date: 2008-08-11 04:15:16 -0400 (Mon, 11 Aug 2008)
New Revision: 15022
Added:
search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdTest.java
Modified:
search/trunk/src/test/org/hibernate/search/test/id/providedId/JBossCachePerson.java
Log:
Finished ProvidedIdTest
Modified: search/trunk/src/test/org/hibernate/search/test/id/providedId/JBossCachePerson.java
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/id/providedId/JBossCachePerson.java 2008-08-11 06:16:59 UTC (rev 15021)
+++ search/trunk/src/test/org/hibernate/search/test/id/providedId/JBossCachePerson.java 2008-08-11 08:15:16 UTC (rev 15022)
@@ -1,8 +1,9 @@
package org.hibernate.search.test.id.providedId;
import org.hibernate.search.annotations.*;
-import org.hibernate.annotations.Entity;
+import javax.persistence.Entity;
+import javax.persistence.Id;
import java.io.Serializable;
@@ -15,6 +16,7 @@
public class JBossCachePerson implements Serializable
{
+ @Id
@Field (index = Index.TOKENIZED, store = Store.YES)
private String name;
@Field (index = Index.TOKENIZED, store = Store.YES)
Copied: search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdTest.java (from rev 15021, search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java)
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdTest.java (rev 0)
+++ search/trunk/src/test/org/hibernate/search/test/id/providedId/ProvidedIdTest.java 2008-08-11 08:15:16 UTC (rev 15022)
@@ -0,0 +1,71 @@
+package org.hibernate.search.test.id.providedId;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.search.test.SearchTestCase;
+import org.hibernate.search.Search;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.FullTextQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+import java.util.List;
+
+/**
+ * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
+ */
+public class ProvidedIdTest extends SearchTestCase {
+
+ JBossCachePerson person1, person2, person3, person4;
+
+ protected Class[] getMappings() {
+ return new Class[]{
+ JBossCachePerson.class
+ };
+ }
+
+ public void testProvidedId() throws ParseException {
+
+ person1 = new JBossCachePerson();
+ person1.setName("Navin Surtani");
+ person1.setBlurb("Likes playing WoW");
+
+ person2 = new JBossCachePerson();
+ person2.setName("Big Goat");
+ person2.setBlurb("Eats grass");
+
+ person3 = new JBossCachePerson();
+ person3.setName("Mini Goat");
+ person3.setBlurb("Eats cheese");
+
+ person4 = new JBossCachePerson();
+ person4.setName("Smelly Cat");
+ person4.setBlurb("Eats fish");
+
+
+ Session session = openSession();
+ FullTextSession fullTextSession = Search.getFullTextSession(session);
+ Transaction transaction = fullTextSession.beginTransaction();
+ session.save(person1);
+ session.save(person2);
+ session.save(person3);
+ session.save(person4);
+
+ QueryParser parser = new QueryParser("Name", new StandardAnalyzer());
+ Query luceneQuery = parser.parse("Goat");
+
+ FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery, JBossCachePerson.class);
+
+
+ List results = fullTextQuery.list();
+
+ transaction.commit();
+ session.close();
+
+ System.out.println("result size is " + results.size());
+ }
+
+
+}
16 years, 4 months
Hibernate SVN: r15021 - in search/trunk/src: test/org/hibernate/search/test/id and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: navssurtani
Date: 2008-08-11 02:16:59 -0400 (Mon, 11 Aug 2008)
New Revision: 15021
Added:
search/trunk/src/test/org/hibernate/search/test/id/providedId/
search/trunk/src/test/org/hibernate/search/test/id/providedId/JBossCachePerson.java
search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java
Modified:
search/trunk/src/java/org/hibernate/search/annotations/ProvidedId.java
Log:
Created ProvidedId test and edited mailto for @ProvidedId
Modified: search/trunk/src/java/org/hibernate/search/annotations/ProvidedId.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/annotations/ProvidedId.java 2008-08-09 15:25:56 UTC (rev 15020)
+++ search/trunk/src/java/org/hibernate/search/annotations/ProvidedId.java 2008-08-11 06:16:59 UTC (rev 15021)
@@ -15,7 +15,7 @@
* <p/>
* This annotation should not be used in conjunction with {@link org.hibernate.search.annotations.DocumentId}
*
- * @author Navin Surtani - navin(a)surtani.org
+ * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.TYPE )
Added: search/trunk/src/test/org/hibernate/search/test/id/providedId/JBossCachePerson.java
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/id/providedId/JBossCachePerson.java (rev 0)
+++ search/trunk/src/test/org/hibernate/search/test/id/providedId/JBossCachePerson.java 2008-08-11 06:16:59 UTC (rev 15021)
@@ -0,0 +1,55 @@
+package org.hibernate.search.test.id.providedId;
+
+import org.hibernate.search.annotations.*;
+import org.hibernate.annotations.Entity;
+
+import java.io.Serializable;
+
+
+/**
+ @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
+ */
+@Entity
+@ProvidedId
+@Indexed
+public class JBossCachePerson implements Serializable
+{
+
+ @Field (index = Index.TOKENIZED, store = Store.YES)
+ private String name;
+ @Field (index = Index.TOKENIZED, store = Store.YES)
+ private String blurb;
+ @Field (index = Index.UN_TOKENIZED, store = Store.YES)
+ private int age;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getBlurb()
+ {
+ return blurb;
+ }
+
+ public void setBlurb(String blurb)
+ {
+ this.blurb = blurb;
+ }
+
+ public int getAge()
+ {
+ return age;
+ }
+
+ public void setAge(int age)
+ {
+ this.age = age;
+ }
+
+}
Added: search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java (rev 0)
+++ search/trunk/src/test/org/hibernate/search/test/id/providedId/TestProvidedId.java 2008-08-11 06:16:59 UTC (rev 15021)
@@ -0,0 +1,71 @@
+package org.hibernate.search.test.id.providedId;
+
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.search.test.SearchTestCase;
+import org.hibernate.search.Search;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.FullTextQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+
+import java.util.List;
+
+/**
+ * @author Navin Surtani (<a href="mailto:nsurtani@redhat.com">nsurtani(a)redhat.com</a>)
+ */
+public class TestProvidedId extends SearchTestCase {
+
+ JBossCachePerson person1, person2, person3, person4;
+
+ protected Class[] getMappings() {
+ return new Class[]{
+ JBossCachePerson.class
+ };
+ }
+
+ public void testProvidedId() throws ParseException {
+
+ person1 = new JBossCachePerson();
+ person1.setName("Navin Surtani");
+ person1.setBlurb("Likes playing WoW");
+
+ person2 = new JBossCachePerson();
+ person2.setName("Big Goat");
+ person2.setBlurb("Eats grass");
+
+ person3 = new JBossCachePerson();
+ person3.setName("Mini Goat");
+ person3.setBlurb("Eats cheese");
+
+ person4 = new JBossCachePerson();
+ person4.setName("Smelly Cat");
+ person4.setBlurb("Eats fish");
+
+
+ Session session = openSession();
+ FullTextSession fullTextSession = Search.getFullTextSession(session);
+ Transaction transaction = fullTextSession.beginTransaction();
+ session.save(person1);
+ session.save(person2);
+ session.save(person3);
+ session.save(person4);
+
+ QueryParser parser = new QueryParser("Name", new StandardAnalyzer());
+ Query luceneQuery = parser.parse("Goat");
+
+ FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery, JBossCachePerson.class);
+
+
+ List results = fullTextQuery.list();
+
+ transaction.commit();
+ session.close();
+
+ System.out.println("result size is " + results.size());
+ }
+
+
+}
16 years, 4 months
Hibernate SVN: r15020 - search/trunk/doc/reference/en/modules.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2008-08-09 11:25:56 -0400 (Sat, 09 Aug 2008)
New Revision: 15020
Modified:
search/trunk/doc/reference/en/modules/configuration.xml
Log:
Change ConnectionFactory to a more accessible JNDI name
Modified: search/trunk/doc/reference/en/modules/configuration.xml
===================================================================
--- search/trunk/doc/reference/en/modules/configuration.xml 2008-08-06 10:44:01 UTC (rev 15019)
+++ search/trunk/doc/reference/en/modules/configuration.xml 2008-08-09 15:25:56 UTC (rev 15020)
@@ -308,7 +308,7 @@
<entry>Mandatory for the JMS back end. Defines the JNDI name to
lookup the JMS connection factory from
- (<literal>java:/ConnectionFactory</literal> by default in JBoss
+ (<literal>/ConnectionFactory</literal> by default in JBoss
AS)</entry>
</row>
@@ -353,7 +353,7 @@
## Backend configuration
hibernate.search.worker.backend = jms
-hibernate.search.worker.jms.connection_factory = java:/ConnectionFactory
+hibernate.search.worker.jms.connection_factory = /ConnectionFactory
hibernate.search.worker.jms.queue = queue/hibernatesearch
#optional jndi configuration (check your JMS provider for more information)
16 years, 4 months
Hibernate SVN: r15019 - in search/trunk/src: java/org/hibernate/search/engine and 4 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-08-06 06:44:01 -0400 (Wed, 06 Aug 2008)
New Revision: 15019
Added:
search/trunk/src/test/org/hibernate/search/test/util/AnalyzerUtils.java
Modified:
search/trunk/src/java/org/hibernate/search/SearchFactory.java
search/trunk/src/java/org/hibernate/search/engine/DocumentBuilder.java
search/trunk/src/java/org/hibernate/search/impl/SearchFactoryImpl.java
search/trunk/src/java/org/hibernate/search/util/ScopedAnalyzer.java
search/trunk/src/test/org/hibernate/search/test/analyzer/AnalyzerTest.java
Log:
now ScopedAnalyzer is not explicitly exposed anymore from SearchFactory.
Modified: search/trunk/src/java/org/hibernate/search/SearchFactory.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/SearchFactory.java 2008-08-05 23:47:13 UTC (rev 15018)
+++ search/trunk/src/java/org/hibernate/search/SearchFactory.java 2008-08-06 10:44:01 UTC (rev 15019)
@@ -4,7 +4,6 @@
import org.apache.lucene.analysis.Analyzer;
import org.hibernate.search.reader.ReaderProvider;
import org.hibernate.search.store.DirectoryProvider;
-import org.hibernate.search.util.ScopedAnalyzer;
/**
* Provide application wide operations as well as access to the underlying Lucene resources.
@@ -52,5 +51,5 @@
* @throws IllegalArgumentException in case <code>clazz == null</code> or the specified
* class is not an indexed entity.
*/
- ScopedAnalyzer getAnalyzer(Class clazz);
+ Analyzer getAnalyzer(Class clazz);
}
Modified: search/trunk/src/java/org/hibernate/search/engine/DocumentBuilder.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/engine/DocumentBuilder.java 2008-08-05 23:47:13 UTC (rev 15018)
+++ search/trunk/src/java/org/hibernate/search/engine/DocumentBuilder.java 2008-08-06 10:44:01 UTC (rev 15019)
@@ -705,7 +705,7 @@
return shardingStrategy;
}
- public ScopedAnalyzer getAnalyzer() {
+ public Analyzer getAnalyzer() {
return analyzer;
}
Modified: search/trunk/src/java/org/hibernate/search/impl/SearchFactoryImpl.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/impl/SearchFactoryImpl.java 2008-08-05 23:47:13 UTC (rev 15018)
+++ search/trunk/src/java/org/hibernate/search/impl/SearchFactoryImpl.java 2008-08-06 10:44:01 UTC (rev 15019)
@@ -308,7 +308,7 @@
return analyzer;
}
- public ScopedAnalyzer getAnalyzer(Class clazz) {
+ public Analyzer getAnalyzer(Class clazz) {
if ( clazz == null) {
throw new IllegalArgumentException( "A class has to be specified for retrieving a scoped analyzer" );
}
Modified: search/trunk/src/java/org/hibernate/search/util/ScopedAnalyzer.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/util/ScopedAnalyzer.java 2008-08-05 23:47:13 UTC (rev 15018)
+++ search/trunk/src/java/org/hibernate/search/util/ScopedAnalyzer.java 2008-08-06 10:44:01 UTC (rev 15019)
@@ -4,49 +4,45 @@
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
/**
+ * A <code>ScopedAnalyzer</code> is a wrapper class containing all analyzers for a given class.
+ * <code>ScopedAnalyzer</code> behaves similar to <code>PerFieldAnalyzerWrapper</code> by delegating requests for
+ * <code>TokenStream</code>s to the underlying <code>Analyzer</code> depending on the requested the field name.
+ *
* @author Emmanuel Bernard
*/
public class ScopedAnalyzer extends Analyzer {
- public ScopedAnalyzer() {}
+ public ScopedAnalyzer() {
+ }
private Analyzer globalAnalyzer;
private Map<String, Analyzer> scopedAnalyzers = new HashMap<String, Analyzer>();
- public void setGlobalAnalyzer(Analyzer globalAnalyzer) {
+ public void setGlobalAnalyzer( Analyzer globalAnalyzer ) {
this.globalAnalyzer = globalAnalyzer;
}
-
- public Analyzer getGlobalAnalyzer() {
- return globalAnalyzer;
- }
- public void addScopedAnalyzer(String scope, Analyzer scopedAnalyzer) {
- scopedAnalyzers.put( scope, scopedAnalyzer );
+ public void addScopedAnalyzer( String scope, Analyzer scopedAnalyzer ) {
+ scopedAnalyzers.put(scope, scopedAnalyzer);
}
- public TokenStream tokenStream(String fieldName, Reader reader) {
- return getAnalyzer( fieldName ).tokenStream( fieldName, reader );
+ public TokenStream tokenStream( String fieldName, Reader reader ) {
+ return getAnalyzer(fieldName).tokenStream(fieldName, reader);
}
- public int getPositionIncrementGap(String fieldName) {
- return getAnalyzer( fieldName ).getPositionIncrementGap( fieldName );
+ public int getPositionIncrementGap( String fieldName ) {
+ return getAnalyzer(fieldName).getPositionIncrementGap(fieldName);
}
- public Analyzer getAnalyzer(String fieldName) {
- Analyzer analyzer = scopedAnalyzers.get( fieldName );
- if (analyzer == null) {
+ private Analyzer getAnalyzer( String fieldName ) {
+ Analyzer analyzer = scopedAnalyzers.get(fieldName);
+ if ( analyzer == null ) {
analyzer = globalAnalyzer;
}
return analyzer;
}
-
- public Set<String> getFields() {
- return scopedAnalyzers.keySet();
- }
}
Modified: search/trunk/src/test/org/hibernate/search/test/analyzer/AnalyzerTest.java
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/analyzer/AnalyzerTest.java 2008-08-05 23:47:13 UTC (rev 15018)
+++ search/trunk/src/test/org/hibernate/search/test/analyzer/AnalyzerTest.java 2008-08-06 10:44:01 UTC (rev 15019)
@@ -1,9 +1,8 @@
// $Id$
package org.hibernate.search.test.analyzer;
-import java.util.HashSet;
-import java.util.Set;
-
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.QueryParser;
import org.hibernate.Transaction;
@@ -12,7 +11,7 @@
import org.hibernate.search.Search;
import org.hibernate.search.SearchFactory;
import org.hibernate.search.test.SearchTestCase;
-import org.hibernate.search.util.ScopedAnalyzer;
+import org.hibernate.search.test.util.AnalyzerUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -21,83 +20,77 @@
*/
public class AnalyzerTest extends SearchTestCase {
- public static final Logger log = LoggerFactory.getLogger( AnalyzerTest.class );
+ public static final Logger log = LoggerFactory.getLogger(AnalyzerTest.class);
public void testScopedAnalyzers() throws Exception {
MyEntity en = new MyEntity();
- en.setEntity( "Entity" );
- en.setField( "Field" );
- en.setProperty( "Property" );
- en.setComponent( new MyComponent() );
- en.getComponent().setComponentProperty( "component property" );
- FullTextSession s = Search.getFullTextSession( openSession() );
+ en.setEntity("Entity");
+ en.setField("Field");
+ en.setProperty("Property");
+ en.setComponent(new MyComponent());
+ en.getComponent().setComponentProperty("component property");
+ FullTextSession s = Search.getFullTextSession(openSession());
Transaction tx = s.beginTransaction();
- s.persist( en );
+ s.persist(en);
tx.commit();
tx = s.beginTransaction();
- QueryParser parser = new QueryParser( "id", new StandardAnalyzer() );
- org.apache.lucene.search.Query luceneQuery = parser.parse( "entity:alarm" );
- FullTextQuery query = s.createFullTextQuery( luceneQuery, MyEntity.class );
- assertEquals( 1, query.getResultSize() );
+ QueryParser parser = new QueryParser("id", new StandardAnalyzer());
+ org.apache.lucene.search.Query luceneQuery = parser.parse("entity:alarm");
+ FullTextQuery query = s.createFullTextQuery(luceneQuery, MyEntity.class);
+ assertEquals(1, query.getResultSize());
- luceneQuery = parser.parse( "property:cat" );
- query = s.createFullTextQuery( luceneQuery, MyEntity.class );
- assertEquals( 1, query.getResultSize() );
+ luceneQuery = parser.parse("property:cat");
+ query = s.createFullTextQuery(luceneQuery, MyEntity.class);
+ assertEquals(1, query.getResultSize());
- luceneQuery = parser.parse( "field:energy" );
- query = s.createFullTextQuery( luceneQuery, MyEntity.class );
- assertEquals( 1, query.getResultSize() );
+ luceneQuery = parser.parse("field:energy");
+ query = s.createFullTextQuery(luceneQuery, MyEntity.class);
+ assertEquals(1, query.getResultSize());
- luceneQuery = parser.parse( "component.componentProperty:noise" );
- query = s.createFullTextQuery( luceneQuery, MyEntity.class );
- assertEquals( 1, query.getResultSize() );
+ luceneQuery = parser.parse("component.componentProperty:noise");
+ query = s.createFullTextQuery(luceneQuery, MyEntity.class);
+ assertEquals(1, query.getResultSize());
- s.delete( query.uniqueResult() );
+ s.delete(query.uniqueResult());
tx.commit();
s.close();
}
- public void testScopedAnalyzersAPI() throws Exception {
- FullTextSession session = Search.getFullTextSession( openSession() );
+ public void testScopedAnalyzersFromSearchFactory() throws Exception {
+ FullTextSession session = Search.getFullTextSession(openSession());
SearchFactory searchFactory = session.getSearchFactory();
- ScopedAnalyzer analzyer = searchFactory.getAnalyzer( MyEntity.class );
+ Analyzer analyzer = searchFactory.getAnalyzer(MyEntity.class);
- // explicitly get the global analyzer
- assertEquals( "Wrong analyzer", Test1Analyzer.class, analzyer.getGlobalAnalyzer().getClass() );
+ // you can pass what so ever into the analysis since the used analyzers are
+ // returning the same tokens all the time. We just want to make sure that
+ // the right analyzers are used.
+ Token[] tokens = AnalyzerUtils.tokensFromAnalysis(analyzer, "entity", "");
+ AnalyzerUtils.assertTokensEqual(tokens, new String[] { "alarm", "dog", "performance" });
- // get the global analyzer by specifying a non existing field or null
- assertEquals( "Wrong analyzer", Test1Analyzer.class, analzyer.getAnalyzer("").getClass() );
- assertEquals( "Wrong analyzer", Test1Analyzer.class, analzyer.getAnalyzer(null).getClass() );
-
- // get a field analyzer
- assertEquals( "Wrong analyzer", Test1Analyzer.class, analzyer.getAnalyzer("entity").getClass() );
- assertEquals( "Wrong analyzer", Test2Analyzer.class, analzyer.getAnalyzer("property").getClass() );
- assertEquals( "Wrong analyzer", Test3Analyzer.class, analzyer.getAnalyzer("field").getClass() );
- assertEquals( "Wrong analyzer", Test4Analyzer.class, analzyer.getAnalyzer("component.componentProperty").getClass() );
-
- // get the field set
- Set<String> fields = new HashSet<String>();
- fields.add( "entity" );
- fields.add( "property" );
- fields.add( "field" );
- fields.add( "component.componentProperty" );
- assertEquals( "Wrong field set", fields, analzyer.getFields());
-
+ tokens = AnalyzerUtils.tokensFromAnalysis(analyzer, "property", "");
+ AnalyzerUtils.assertTokensEqual(tokens, new String[] { "sound", "cat", "speed" });
+
+ tokens = AnalyzerUtils.tokensFromAnalysis(analyzer, "field", "");
+ AnalyzerUtils.assertTokensEqual(tokens, new String[] { "music", "elephant", "energy" });
+
+ tokens = AnalyzerUtils.tokensFromAnalysis(analyzer, "component.componentProperty", "");
+ AnalyzerUtils.assertTokensEqual(tokens, new String[] { "noise", "mouse", "light" });
+
// test border cases
try {
- searchFactory.getAnalyzer( (Class) null );
- } catch (IllegalArgumentException iae) {
- log.debug( "success" );
+ searchFactory.getAnalyzer((Class) null);
+ } catch ( IllegalArgumentException iae ) {
+ log.debug("success");
}
-
+
try {
- searchFactory.getAnalyzer( String.class );
- } catch (IllegalArgumentException iae) {
- log.debug( "success" );
- }
-
+ searchFactory.getAnalyzer(String.class);
+ } catch ( IllegalArgumentException iae ) {
+ log.debug("success");
+ }
+
session.close();
}
Added: search/trunk/src/test/org/hibernate/search/test/util/AnalyzerUtils.java
===================================================================
--- search/trunk/src/test/org/hibernate/search/test/util/AnalyzerUtils.java (rev 0)
+++ search/trunk/src/test/org/hibernate/search/test/util/AnalyzerUtils.java 2008-08-06 10:44:01 UTC (rev 15019)
@@ -0,0 +1,101 @@
+// $Id:$
+package org.hibernate.search.test.util;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Helper class to test analyzers. Taken and modified from <i>Lucene in Action</i>.
+ *
+ * @author Hardy Ferentschik
+ */
+public class AnalyzerUtils {
+
+ public static final Logger log = LoggerFactory.getLogger(AnalyzerUtils.class);
+
+ public static Token[] tokensFromAnalysis(Analyzer analyzer, String field, String text) throws IOException {
+ TokenStream stream = analyzer.tokenStream(field, new StringReader(text));
+ List<Token> tokenList = new ArrayList<Token>();
+ while ( true ) {
+ Token token = stream.next();
+ if ( token == null )
+ break;
+
+ tokenList.add(token);
+ }
+
+ return (Token[]) tokenList.toArray(new Token[0]);
+ }
+
+ public static void displayTokens(Analyzer analyzer, String field, String text) throws IOException {
+ Token[] tokens = tokensFromAnalysis(analyzer, field, text);
+
+ for ( int i = 0; i < tokens.length; i++ ) {
+ Token token = tokens[i];
+ log.debug("[" + getTermText(token) + "] ");
+ }
+ }
+
+ public static void displayTokensWithPositions(Analyzer analyzer, String field, String text) throws IOException {
+ Token[] tokens = tokensFromAnalysis(analyzer, field, text);
+
+ int position = 0;
+
+ for ( int i = 0; i < tokens.length; i++ ) {
+ Token token = tokens[i];
+
+ int increment = token.getPositionIncrement();
+
+ if ( increment > 0 ) {
+ position = position + increment;
+ System.out.println();
+ System.out.print(position + ": ");
+ }
+
+ log.debug("[" + getTermText(token) + "] ");
+ }
+ }
+
+ public static void displayTokensWithFullDetails(Analyzer analyzer, String field, String text) throws IOException {
+ Token[] tokens = tokensFromAnalysis(analyzer, field, text);
+ StringBuilder builder = new StringBuilder();
+ int position = 0;
+
+ for ( int i = 0; i < tokens.length; i++ ) {
+ Token token = tokens[i];
+
+ int increment = token.getPositionIncrement();
+
+ if ( increment > 0 ) {
+ position = position + increment;
+ builder.append("\n").append(position).append(": ");
+ }
+
+ builder.append("[").append(getTermText(token)).append(":").append(token.startOffset()).append("->").append(
+ token.endOffset()).append(":").append(token.type()).append("] ");
+ log.debug(builder.toString());
+ }
+ }
+
+ public static void assertTokensEqual(Token[] tokens, String[] strings) {
+ Assert.assertEquals(strings.length, tokens.length);
+
+ for ( int i = 0; i < tokens.length; i++ ) {
+ Assert.assertEquals("index " + i, strings[i], getTermText(tokens[i]));
+ }
+ }
+
+ public static String getTermText(Token token) {
+ return new String(token.termBuffer(), 0, token.termLength());
+ }
+}
Property changes on: search/trunk/src/test/org/hibernate/search/test/util/AnalyzerUtils.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 4 months
Hibernate SVN: r15018 - search/trunk/src/java/org/hibernate/search/backend/impl/jms.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2008-08-05 19:47:13 -0400 (Tue, 05 Aug 2008)
New Revision: 15018
Modified:
search/trunk/src/java/org/hibernate/search/backend/impl/jms/JMSBackendQueueProcessor.java
Log:
Avoid JMS connection leak
Modified: search/trunk/src/java/org/hibernate/search/backend/impl/jms/JMSBackendQueueProcessor.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/backend/impl/jms/JMSBackendQueueProcessor.java 2008-08-05 16:31:07 UTC (rev 15017)
+++ search/trunk/src/java/org/hibernate/search/backend/impl/jms/JMSBackendQueueProcessor.java 2008-08-05 23:47:13 UTC (rev 15018)
@@ -10,6 +10,9 @@
import javax.jms.QueueSender;
import javax.jms.QueueSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import org.hibernate.HibernateException;
import org.hibernate.search.backend.LuceneWork;
import org.hibernate.search.backend.OptimizeLuceneWork;
@@ -20,6 +23,7 @@
public class JMSBackendQueueProcessor implements Runnable {
private List<LuceneWork> queue;
private JMSBackendQueueProcessorFactory factory;
+ private Logger log = LoggerFactory.getLogger( JMSBackendQueueProcessor.class );
public JMSBackendQueueProcessor(List<LuceneWork> queue,
JMSBackendQueueProcessorFactory jmsBackendQueueProcessorFactory) {
@@ -37,7 +41,7 @@
}
if ( filteredQueue.size() == 0) return;
factory.prepareJMSTools();
- QueueConnection cnn;
+ QueueConnection cnn = null;
QueueSender sender;
QueueSession session;
try {
@@ -52,10 +56,18 @@
sender.send( message );
session.close();
- cnn.close();
}
catch (JMSException e) {
throw new HibernateException( "Unable to send Search work to JMS queue: " + factory.getJmsQueueName(), e );
}
+ finally {
+ try {
+ if (cnn != null)
+ cnn.close();
+ }
+ catch ( JMSException e ) {
+ log.warn( "Unable to close JMS connection for " + factory.getJmsQueueName(), e );
+ }
+ }
}
}
16 years, 4 months
Hibernate SVN: r15017 - search/trunk/src/java/org/hibernate/search/impl.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2008-08-05 12:31:07 -0400 (Tue, 05 Aug 2008)
New Revision: 15017
Added:
search/trunk/src/java/org/hibernate/search/impl/SolrAnalyzerBuilder.java
Modified:
search/trunk/src/java/org/hibernate/search/impl/InitContext.java
Log:
HSEARCH-247 remove hard dependency on Solr when not needed
Modified: search/trunk/src/java/org/hibernate/search/impl/InitContext.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/impl/InitContext.java 2008-08-05 10:26:27 UTC (rev 15016)
+++ search/trunk/src/java/org/hibernate/search/impl/InitContext.java 2008-08-05 16:31:07 UTC (rev 15017)
@@ -1,27 +1,22 @@
// $Id:$
package org.hibernate.search.impl;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
-import org.hibernate.search.annotations.AnalyzerDef;
-import org.hibernate.search.annotations.TokenizerDef;
-import org.hibernate.search.annotations.Parameter;
-import org.hibernate.search.annotations.TokenFilterDef;
-import org.hibernate.search.SearchException;
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.search.Similarity;
+
import org.hibernate.search.Environment;
+import org.hibernate.search.SearchException;
+import org.hibernate.search.annotations.AnalyzerDef;
import org.hibernate.search.cfg.SearchConfiguration;
import org.hibernate.search.util.DelegateNamedAnalyzer;
import org.hibernate.util.ReflectHelper;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.standard.StandardAnalyzer;
-import org.apache.lucene.search.Similarity;
-import org.apache.solr.analysis.TokenizerFactory;
-import org.apache.solr.analysis.TokenizerChain;
-import org.apache.solr.analysis.TokenFilterFactory;
/**
* @author Emmanuel Bernard
@@ -31,10 +26,12 @@
private final List<DelegateNamedAnalyzer> lazyAnalyzers = new ArrayList<DelegateNamedAnalyzer>();
private final Analyzer defaultAnalyzer;
private final Similarity defaultSimilarity;
+ private final boolean solrPresent;
public InitContext(SearchConfiguration cfg) {
defaultAnalyzer = initAnalyzer(cfg);
defaultSimilarity = initSimilarity(cfg);
+ solrPresent = isPresent( "org.apache.solr.analysis.TokenizerFactory" );
}
public void addAnalyzerDef(AnalyzerDef ann) {
@@ -165,37 +162,25 @@
}
private Analyzer buildAnalyzer(AnalyzerDef analyzerDef) {
- TokenizerDef token = analyzerDef.tokenizer();
- TokenizerFactory tokenFactory = (TokenizerFactory) instantiate( token.factory() );
- tokenFactory.init( getMapOfParameters( token.params() ) );
-
- final int length = analyzerDef.filters().length;
- TokenFilterFactory[] filters = new TokenFilterFactory[length];
- for ( int index = 0 ; index < length ; index++ ) {
- TokenFilterDef filterDef = analyzerDef.filters()[index];
- filters[index] = (TokenFilterFactory) instantiate( filterDef.factory() );
- filters[index].init( getMapOfParameters( filterDef.params() ) );
+ if ( ! solrPresent ) {
+ throw new SearchException( "Use of @AnalyzerDef while Solr is not present in the classpath. Add apache-solr-analyzer.jar" );
}
- return new TokenizerChain(tokenFactory, filters);
+ //SolrAnalyzerBuilder references Solr classes.
+ //InitContext should not (directly or indirectly) load a Solr class to avoid hard dependency
+ // unless necessary
+ // the curent mecanism (check sor class presence and call SolrAnalyzerBuilder if needed
+ // seems to be sufficient on Apple VM (derived from Sun's
+ // TODO check on other VMs and be ready for a more reflexive approach
+ return SolrAnalyzerBuilder.buildAnalyzer( analyzerDef );
}
- private Object instantiate(Class clazz) {
+ private boolean isPresent(String classname) {
try {
- return clazz.newInstance();
+ ReflectHelper.classForName( classname, InitContext.class );
+ return true;
}
- catch (IllegalAccessException e) {
- throw new SearchException( "Unable to instantiate class: " + clazz, e );
+ catch ( Exception e ) {
+ return false;
}
- catch (InstantiationException e) {
- throw new SearchException( "Unable to instantiate class: " + clazz, e );
- }
}
-
- private Map<String, String> getMapOfParameters(Parameter[] params) {
- Map<String, String> mapOfParams = new HashMap<String, String>( params.length );
- for (Parameter param : params) {
- mapOfParams.put( param.name(), param.value() );
- }
- return Collections.unmodifiableMap( mapOfParams );
- }
}
Added: search/trunk/src/java/org/hibernate/search/impl/SolrAnalyzerBuilder.java
===================================================================
--- search/trunk/src/java/org/hibernate/search/impl/SolrAnalyzerBuilder.java (rev 0)
+++ search/trunk/src/java/org/hibernate/search/impl/SolrAnalyzerBuilder.java 2008-08-05 16:31:07 UTC (rev 15017)
@@ -0,0 +1,60 @@
+package org.hibernate.search.impl;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.solr.analysis.TokenizerChain;
+import org.apache.solr.analysis.TokenFilterFactory;
+import org.apache.solr.analysis.TokenizerFactory;
+
+import org.hibernate.search.annotations.AnalyzerDef;
+import org.hibernate.search.annotations.TokenizerDef;
+import org.hibernate.search.annotations.TokenFilterDef;
+import org.hibernate.search.annotations.Parameter;
+import org.hibernate.search.SearchException;
+
+/**
+ * This class has a direct dependency on Solr classes
+ *
+ * @author Emmanuel Bernard
+ */
+class SolrAnalyzerBuilder {
+ private SolrAnalyzerBuilder() {}
+
+ public static Analyzer buildAnalyzer(AnalyzerDef analyzerDef) {
+ TokenizerDef token = analyzerDef.tokenizer();
+ TokenizerFactory tokenFactory = ( TokenizerFactory ) instantiate( token.factory() );
+ tokenFactory.init( getMapOfParameters( token.params() ) );
+
+ final int length = analyzerDef.filters().length;
+ TokenFilterFactory[] filters = new TokenFilterFactory[length];
+ for ( int index = 0 ; index < length ; index++ ) {
+ TokenFilterDef filterDef = analyzerDef.filters()[index];
+ filters[index] = (TokenFilterFactory) instantiate( filterDef.factory() );
+ filters[index].init( getMapOfParameters( filterDef.params() ) );
+ }
+ return new TokenizerChain(tokenFactory, filters);
+ }
+
+ private static Object instantiate(Class clazz) {
+ try {
+ return clazz.newInstance();
+ }
+ catch (IllegalAccessException e) {
+ throw new SearchException( "Unable to instantiate class: " + clazz, e );
+ }
+ catch (InstantiationException e) {
+ throw new SearchException( "Unable to instantiate class: " + clazz, e );
+ }
+ }
+
+ private static Map<String, String> getMapOfParameters(Parameter[] params) {
+ Map<String, String> mapOfParams = new HashMap<String, String>( params.length );
+ for (Parameter param : params) {
+ mapOfParams.put( param.name(), param.value() );
+ }
+ return Collections.unmodifiableMap( mapOfParams );
+ }
+}
16 years, 4 months