Hibernate SVN: r16591 - core/branches/Branch_3_2/test/org/hibernate/test/component/basic.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2009-05-18 16:47:10 -0400 (Mon, 18 May 2009)
New Revision: 16591
Modified:
core/branches/Branch_3_2/test/org/hibernate/test/component/basic/ComponentTest.java
Log:
HHH-3510 : Add FailureExpected test for HQL SQLFunction replacement not occuring when HQL text has no parenthesis
Modified: core/branches/Branch_3_2/test/org/hibernate/test/component/basic/ComponentTest.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/component/basic/ComponentTest.java 2009-05-18 20:29:28 UTC (rev 16590)
+++ core/branches/Branch_3_2/test/org/hibernate/test/component/basic/ComponentTest.java 2009-05-18 20:47:10 UTC (rev 16591)
@@ -16,6 +16,7 @@
import org.hibernate.criterion.Property;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.SQLFunction;
+import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.junit.functional.FunctionalTestCase;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.mapping.Component;
@@ -157,12 +158,38 @@
s.createQuery( "from Employee e where e.person = :p and 1 = 1 and 2=2" ).setParameter( "p", emp.getPerson() ).list();
s.createQuery( "from Employee e where :p = e.person" ).setParameter( "p", emp.getPerson() ).list();
- s.createQuery( "from Employee e where e.person = ('steve', current_timestamp)" ).list();
+ // The following fails on Sybase due to HHH-3510. When HHH-3510
+ // is fixed, the check for SybaseASE15Dialect should be removed.
+ if ( ! ( getDialect() instanceof SybaseASE15Dialect ) ) {
+ s.createQuery( "from Employee e where e.person = ('steve', current_timestamp)" ).list();
+ }
s.delete( emp );
t.commit();
s.close();
}
+
+ // Sybase should translate "current_timestamp" in HQL to "getdate()";
+ // This fails currently due to HHH-3510. The following test should be
+ // deleted and testComponentQueries() should be updated (as noted
+ // in that test case) when HHH-3510 is fixed.
+ public void testComponentQueryMethodNoParensFailureExpected() {
+ if ( ! ( getDialect() instanceof SybaseASE15Dialect ) ) {
+ fail( "Dialect does not apply to test that is expected to fail; force failure" );
+ }
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ Employee emp = new Employee();
+ emp.setHireDate( new Date() );
+ emp.setPerson( new Person() );
+ emp.getPerson().setName( "steve" );
+ emp.getPerson().setDob( new Date() );
+ s.save( emp );
+ s.createQuery( "from Employee e where e.person = ('steve', current_timestamp)" ).list();
+ s.delete( emp );
+ t.commit();
+ s.close();
+ }
public void testComponentFormulaQuery() {
Session s = openSession();
15 years, 6 months
Hibernate SVN: r16590 - core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/component/basic.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2009-05-18 16:29:28 -0400 (Mon, 18 May 2009)
New Revision: 16590
Modified:
core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/component/basic/ComponentTest.java
Log:
JBPAPP-1229 HHH-3510 : Add FailureExpected test for HQL SQLFunction replacement not occuring when HQL text has no parenthesis
Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/component/basic/ComponentTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/component/basic/ComponentTest.java 2009-05-18 16:52:40 UTC (rev 16589)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/component/basic/ComponentTest.java 2009-05-18 20:29:28 UTC (rev 16590)
@@ -16,6 +16,7 @@
import org.hibernate.criterion.Property;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.SQLFunction;
+import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.junit.functional.FunctionalTestCase;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.mapping.Component;
@@ -157,12 +158,38 @@
s.createQuery( "from Employee e where e.person = :p and 1 = 1 and 2=2" ).setParameter( "p", emp.getPerson() ).list();
s.createQuery( "from Employee e where :p = e.person" ).setParameter( "p", emp.getPerson() ).list();
- s.createQuery( "from Employee e where e.person = ('steve', current_timestamp)" ).list();
+ // The following fails on Sybase due to HHH-3510. When HHH-3510
+ // is fixed, the check for SybaseASE15Dialect should be removed.
+ if ( ! ( getDialect() instanceof SybaseASE15Dialect ) ) {
+ s.createQuery( "from Employee e where e.person = ('steve', current_timestamp)" ).list();
+ }
s.delete( emp );
t.commit();
s.close();
}
+
+ // Sybase should translate "current_timestamp" in HQL to "getdate()";
+ // This fails currently due to HHH-3510. The following test should be
+ // deleted and testComponentQueries() should be updated (as noted
+ // in that test case) when HHH-3510 is fixed.
+ public void testComponentQueryMethodNoParensFailureExpected() {
+ if ( ! ( getDialect() instanceof SybaseASE15Dialect ) ) {
+ fail( "Dialect does not apply to test that is expected to fail; force failure" );
+ }
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ Employee emp = new Employee();
+ emp.setHireDate( new Date() );
+ emp.setPerson( new Person() );
+ emp.getPerson().setName( "steve" );
+ emp.getPerson().setDob( new Date() );
+ s.save( emp );
+ s.createQuery( "from Employee e where e.person = ('steve', current_timestamp)" ).list();
+ s.delete( emp );
+ t.commit();
+ s.close();
+ }
public void testComponentFormulaQuery() {
Session s = openSession();
15 years, 6 months
Hibernate SVN: r16589 - beanvalidation/trunk/validation-tck/src/main/resources.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-18 12:52:40 -0400 (Mon, 18 May 2009)
New Revision: 16589
Modified:
beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
Log:
Modified: beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml
===================================================================
--- beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-05-18 14:11:08 UTC (rev 16588)
+++ beanvalidation/trunk/validation-tck/src/main/resources/tck-audit.xml 2009-05-18 16:52:40 UTC (rev 16589)
@@ -1,11 +1,84 @@
-<specification
- xmlns="http://jboss.com/products/webbeans/tck/audit"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://jboss.com/products/webbeans/tck/audit http://snapshots.jboss.org/maven2/org/hibernate/tck-utils-api/0.9-SNAPSHO..."
- name="JSR-303: Bean Validation"
- version="Revised Public Review Draft">
+<specification xmlns="http://jboss.com/products/webbeans/tck/audit"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.com/products/webbeans/tck/audit http://snapshots.jboss.org/maven2/org/hibernate/tck-utils-api/0.9-SNAPSHO..."
+ name="JSR-303: Bean Validation" version="Revised Public Review Draft">
- <section id="2" title="Bean definition">
+ <section id="2" title="Constraint definition">
+ <assertion id="a">
+ <text>Constraints are defined by the combination of a constraint annotation and a list
+ of constraint validation implement- ations</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>The constraint annotation is applied on types, methods, fields or other constraint
+ annotations </text>
+ </assertion>
</section>
+ <section id="2.1" title="Constraint Definition">
+ <assertion id="a">
+ <text>A constraint on a JavaBean is expressed through one or more annotations</text>
+ </assertion>
+ <assertion id="b">
+ <text>An annotation is considered a constraint definition if its retention policy
+ contains RUNTIME and if the annotation itself is annotated with
+ javax.validation.Constraint</text>
+ </assertion>
+ <assertion id="c">
+ <text>Constraint annotations can target any of the following ElementTypes: FIELD,
+ METHOD, TYPE, ANNOTATION_TYPE</text>
+ </assertion>
+ <assertion id="d">
+ <text>If a constraint definition is not valid, a ConstraintDefinitionException is raised
+ either at validation time or when the metadata is requested</text>
+ </assertion>
+ <assertion id="e">
+ <text>Applying a constraint annotation to an incompatible type will raise a
+ UnexpectedTypeException</text>
+ </assertion>
+ </section>
+
+ <section id="2.1.1" title="Constraint definition properties">
+ <assertion id="a">
+ <text>A constraint definition may have attributes that are specified at the time the
+ constraint is applied to a JavaBean.</text>
+ </assertion>
+ <assertion id="b">
+ <text>annotation elements starting with valid are not allowed</text>
+ </assertion>
+ <assertion id="c">
+ <text>Every constraint annotation must define a message element of type String</text>
+ </assertion>
+ <assertion id="d">
+ <text>Every constraint annotation must define a groups element that specifies which
+ processing groups the constraint definition is associated with.</text>
+ </assertion>
+ <assertion id="e">
+ <text>The default value for the groups element must be an empty array.</text>
+ </assertion>
+ <assertion id="f">
+ <text>If no group is specified when declaring the constraint on an element, the Default
+ group is considered declared. </text>
+ </assertion>
+ </section>
+
+ <section id="2.2" title="Applying multiple constraints of the same type">
+ <assertion id="">
+ <text></text>
+ </assertion>
+ <assertion id="">
+ <text/>
+ </assertion>
+ </section>
+
+
+
+ <!--
+ <assertion id="">
+ <text></text>
+ </assertion>
+ -->
+
+
+
</specification>
15 years, 6 months
Hibernate SVN: r16588 - search/trunk/src/test/java/org/hibernate/search/test/session.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-18 10:11:08 -0400 (Mon, 18 May 2009)
New Revision: 16588
Modified:
search/trunk/src/test/java/org/hibernate/search/test/session/MassIndexTest.java
search/trunk/src/test/java/org/hibernate/search/test/session/SessionTest.java
Log:
Resolved some test issues for PostgeSQL
Modified: search/trunk/src/test/java/org/hibernate/search/test/session/MassIndexTest.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/session/MassIndexTest.java 2009-05-18 13:21:37 UTC (rev 16587)
+++ search/trunk/src/test/java/org/hibernate/search/test/session/MassIndexTest.java 2009-05-18 14:11:08 UTC (rev 16588)
@@ -2,6 +2,7 @@
package org.hibernate.search.test.session;
import java.sql.Statement;
+import java.sql.SQLException;
import java.util.List;
import java.util.Iterator;
@@ -143,27 +144,27 @@
tx.commit();
s.close();
- s = openSession();
+ s = getSessionWithAutoCommit();
FullTextSession session = Search.getFullTextSession( s );
Query luceneQuery = new TermQuery( new Term( "categorie.nom", "livre" ) );
List result = session.createFullTextQuery( luceneQuery, Entite.class ).list();
assertEquals( 1, result.size() );
s.close();
- s = openSession();
+ s = getSessionWithAutoCommit();
ent = (Entite) s.get( Entite.class, ent.getId() );
session = Search.getFullTextSession( s );
session.index( ent );
s.close();
- s = openSession();
+ s = getSessionWithAutoCommit();
session = Search.getFullTextSession( s );
luceneQuery = new TermQuery( new Term( "categorie.nom", "livre" ) );
result = session.createFullTextQuery( luceneQuery, Entite.class ).list();
assertEquals( "test lazy loading and indexing", 1, result.size() );
s.close();
- s = openSession();
+ s = getSessionWithAutoCommit();
Iterator it = s.createQuery( "from Entite where id = :id").setParameter( "id", ent.getId() ).iterate();
session = Search.getFullTextSession( s );
while ( it.hasNext() ) {
@@ -172,19 +173,21 @@
}
s.close();
- s = openSession();
+ s = getSessionWithAutoCommit();
session = Search.getFullTextSession( s );
luceneQuery = new TermQuery( new Term( "categorie.nom", "livre" ) );
result = session.createFullTextQuery( luceneQuery, Entite.class ).list();
assertEquals( "test lazy loading and indexing", 1, result.size() );
- ent = (Entite) result.get( 0 );
- cat = ent.getCategorie();
- ent.setCategorie( null );
- session.delete( cat );
- session.delete( ent );
s.close();
}
+ private Session getSessionWithAutoCommit() throws SQLException {
+ Session s;
+ s = openSession();
+ s.connection().setAutoCommit( true );
+ return s;
+ }
+
protected void configure(org.hibernate.cfg.Configuration cfg) {
super.configure( cfg );
cfg.setProperty( "hibernate.search.worker.batch_size", "5" );
Modified: search/trunk/src/test/java/org/hibernate/search/test/session/SessionTest.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/session/SessionTest.java 2009-05-18 13:21:37 UTC (rev 16587)
+++ search/trunk/src/test/java/org/hibernate/search/test/session/SessionTest.java 2009-05-18 14:11:08 UTC (rev 16588)
@@ -2,14 +2,14 @@
package org.hibernate.search.test.session;
import java.lang.reflect.Proxy;
-import java.util.List;
-import org.hibernate.search.test.SearchTestCase;
-import org.hibernate.search.Search;
-import org.hibernate.search.FullTextSession;
+import org.hibernate.Criteria;
import org.hibernate.Session;
-import org.hibernate.Criteria;
+import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.DetachedCriteria;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.Search;
+import org.hibernate.search.test.SearchTestCase;
/**
* @author Emmanuel Bernard
@@ -18,39 +18,39 @@
private static final Class[] SESS_PROXY_INTERFACES = new Class[] {
org.hibernate.classic.Session.class,
- org.hibernate.engine.SessionImplementor.class,
- org.hibernate.jdbc.JDBCContext.Context.class,
- org.hibernate.event.EventSource.class
+ org.hibernate.engine.SessionImplementor.class,
+ org.hibernate.jdbc.JDBCContext.Context.class,
+ org.hibernate.event.EventSource.class
};
public void testSessionWrapper() throws Exception {
- Session s = openSession( );
+ Session s = openSession();
DelegationWrapper wrapper = new DelegationWrapper( s );
- Session wrapped = (Session) Proxy.newProxyInstance(
+ Session wrapped = ( Session ) Proxy.newProxyInstance(
org.hibernate.classic.Session.class.getClassLoader(),
- SESS_PROXY_INTERFACES,
- wrapper
- );
+ SESS_PROXY_INTERFACES,
+ wrapper
+ );
try {
Search.getFullTextSession( wrapped );
}
- catch( ClassCastException e ) {
- e.printStackTrace( );
- fail(e.toString());
+ catch ( ClassCastException e ) {
+ e.printStackTrace();
+ fail( e.toString() );
}
wrapped.close();
}
public void testDetachedCriteria() throws Exception {
- FullTextSession s = Search.getFullTextSession( openSession( ) );
+ FullTextSession s = Search.getFullTextSession( openSession() );
DetachedCriteria dc = DetachedCriteria.forClass( Email.class );
try {
Criteria c = dc.getExecutableCriteria( s ).setMaxResults( 10 );
- List results = c.list();
+ c.list();
}
- catch( ClassCastException e ) {
- e.printStackTrace( );
- fail(e.toString());
+ catch ( ClassCastException e ) {
+ e.printStackTrace();
+ fail( e.toString() );
}
s.close();
}
@@ -61,4 +61,11 @@
Domain.class
};
}
+
+ protected void configure(Configuration cfg) {
+ super.configure( cfg );
+ // for this test we explcitly set the auto commit mode since we are not explcitly starting a transaction
+ // which could be a problem in some databases.
+ cfg.setProperty( "hibernate.connection.autocommit", "true" );
+ }
}
15 years, 6 months
Hibernate SVN: r16587 - in search/trunk: hibernate-search-archetype/src/main/resources/archetype-resources/src/test/java/java/example and 26 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-18 09:21:37 -0400 (Mon, 18 May 2009)
New Revision: 16587
Modified:
search/trunk/hibernate-search-archetype/src/main/resources/archetype-resources/src/main/java/example/Author.java
search/trunk/hibernate-search-archetype/src/main/resources/archetype-resources/src/main/java/example/Book.java
search/trunk/hibernate-search-archetype/src/main/resources/archetype-resources/src/test/java/java/example/IndexAndSearchTest.java
search/trunk/src/main/java/org/hibernate/search/Indexer.java
search/trunk/src/main/java/org/hibernate/search/annotations/FilterCacheModeType.java
search/trunk/src/main/java/org/hibernate/search/annotations/TermVector.java
search/trunk/src/main/java/org/hibernate/search/backend/WorkVisitor.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/DpSelectionDelegate.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/DpSelectionVisitor.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/PerDPQueueProcessor.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/PerDPResources.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/QueueProcessors.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/AddWorkDelegate.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/DeleteExtWorkDelegate.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/DeleteWorkDelegate.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/LuceneWorkDelegate.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/LuceneWorkVisitor.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/OptimizeWorkDelegate.java
search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/PurgeAllWorkDelegate.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/BatchIndexingWorkspace.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/EntityConsumerLuceneworkProducer.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/Executors.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/IdentifierConsumerEntityProducer.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/IdentifierProducer.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/IndexWritingJob.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/IndexerProgressMonitor.java
search/trunk/src/main/java/org/hibernate/search/batchindexing/ProducerConsumerQueue.java
search/trunk/src/main/java/org/hibernate/search/bridge/LuceneOptions.java
search/trunk/src/main/java/org/hibernate/search/cfg/AnalyzerDefMapping.java
search/trunk/src/main/java/org/hibernate/search/cfg/ConcatStringBridge.java
search/trunk/src/main/java/org/hibernate/search/cfg/DocumentIdMapping.java
search/trunk/src/main/java/org/hibernate/search/cfg/EntityDescriptor.java
search/trunk/src/main/java/org/hibernate/search/cfg/EntityMapping.java
search/trunk/src/main/java/org/hibernate/search/cfg/FieldBridgeMapping.java
search/trunk/src/main/java/org/hibernate/search/cfg/FieldMapping.java
search/trunk/src/main/java/org/hibernate/search/cfg/PropertyDescriptor.java
search/trunk/src/main/java/org/hibernate/search/cfg/PropertyMapping.java
search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfiguration.java
search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java
search/trunk/src/main/java/org/hibernate/search/cfg/SearchMapping.java
search/trunk/src/main/java/org/hibernate/search/cfg/TokenFilterDefMapping.java
search/trunk/src/main/java/org/hibernate/search/engine/EntityState.java
search/trunk/src/main/java/org/hibernate/search/impl/IndexerImpl.java
search/trunk/src/main/java/org/hibernate/search/impl/MappingModelMetadataProvider.java
search/trunk/src/main/java/org/hibernate/search/impl/SimpleIndexingProgressMonitor.java
search/trunk/src/main/java/org/hibernate/search/impl/SolrAnalyzerBuilder.java
search/trunk/src/main/java/org/hibernate/search/util/FilterCacheModeTypeHelper.java
search/trunk/src/main/java/org/hibernate/search/util/HibernateSearchResourceLoader.java
search/trunk/src/test/java/org/hibernate/search/test/TestCase.java
search/trunk/src/test/java/org/hibernate/search/test/analyzer/AlarmEntity.java
search/trunk/src/test/java/org/hibernate/search/test/analyzer/DoubleAnalyzerTest.java
search/trunk/src/test/java/org/hibernate/search/test/analyzer/solr/InsertWhitespaceFilter.java
search/trunk/src/test/java/org/hibernate/search/test/batchindexing/AncientBook.java
search/trunk/src/test/java/org/hibernate/search/test/batchindexing/Book.java
search/trunk/src/test/java/org/hibernate/search/test/batchindexing/Dvd.java
search/trunk/src/test/java/org/hibernate/search/test/batchindexing/ModernBook.java
search/trunk/src/test/java/org/hibernate/search/test/batchindexing/SearchIndexerTest.java
search/trunk/src/test/java/org/hibernate/search/test/classloading/Animal.java
search/trunk/src/test/java/org/hibernate/search/test/classloading/NoAnnotationsTest.java
search/trunk/src/test/java/org/hibernate/search/test/configuration/Address.java
search/trunk/src/test/java/org/hibernate/search/test/configuration/Country.java
search/trunk/src/test/java/org/hibernate/search/test/configuration/ProgrammaticMappingTest.java
search/trunk/src/test/java/org/hibernate/search/test/configuration/User.java
search/trunk/src/test/java/org/hibernate/search/test/directoryProvider/CustomLockFactoryFactory.java
search/trunk/src/test/java/org/hibernate/search/test/directoryProvider/CustomLockProviderTest.java
search/trunk/src/test/java/org/hibernate/search/test/embedded/NonIndexedEntity.java
search/trunk/src/test/java/org/hibernate/search/test/embedded/StateCandidate.java
search/trunk/src/test/java/org/hibernate/search/test/engine/EventListenerSerializationTest.java
search/trunk/src/test/java/org/hibernate/search/test/filter/AndDocIdSetsTest.java
search/trunk/src/test/java/org/hibernate/search/test/filter/FiltersOptimizationTest.java
search/trunk/src/test/java/org/hibernate/search/test/filter/InstanceBasedExcludeAllFilter.java
search/trunk/src/test/java/org/hibernate/search/test/id/Animal.java
search/trunk/src/test/java/org/hibernate/search/test/id/providedId/ProvidedIdPerson.java
search/trunk/src/test/java/org/hibernate/search/test/id/providedId/ProvidedIdPersonSub.java
search/trunk/src/test/java/org/hibernate/search/test/id/providedId/ProvidedIdTest.java
search/trunk/src/test/java/org/hibernate/search/test/inheritance/Eagle.java
search/trunk/src/test/java/org/hibernate/search/test/query/ElectricalProperties.java
search/trunk/src/test/java/org/hibernate/search/test/worker/duplication/EmailAddress.java
search/trunk/src/test/java/org/hibernate/search/test/worker/duplication/Person.java
search/trunk/src/test/java/org/hibernate/search/test/worker/duplication/SpecialPerson.java
search/trunk/src/test/java/org/hibernate/search/test/worker/duplication/WorkSequencesTest.java
Log:
Enabled keyword substitution
Property changes on: search/trunk/hibernate-search-archetype/src/main/resources/archetype-resources/src/main/java/example/Author.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/hibernate-search-archetype/src/main/resources/archetype-resources/src/main/java/example/Book.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/hibernate-search-archetype/src/main/resources/archetype-resources/src/test/java/java/example/IndexAndSearchTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/Indexer.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/annotations/FilterCacheModeType.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/annotations/TermVector.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/WorkVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/DpSelectionDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/DpSelectionVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/PerDPQueueProcessor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/PerDPResources.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/QueueProcessors.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/AddWorkDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/DeleteExtWorkDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/DeleteWorkDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/LuceneWorkDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/LuceneWorkVisitor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/OptimizeWorkDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/backend/impl/lucene/works/PurgeAllWorkDelegate.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/batchindexing/BatchIndexingWorkspace.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/batchindexing/EntityConsumerLuceneworkProducer.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/batchindexing/Executors.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/batchindexing/IdentifierConsumerEntityProducer.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/batchindexing/IdentifierProducer.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/batchindexing/IndexWritingJob.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/batchindexing/IndexerProgressMonitor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/batchindexing/ProducerConsumerQueue.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/bridge/LuceneOptions.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/AnalyzerDefMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/ConcatStringBridge.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/DocumentIdMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/EntityDescriptor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/EntityMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/FieldBridgeMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/FieldMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/PropertyDescriptor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/PropertyMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfiguration.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfiguration.java 2009-05-18 13:18:59 UTC (rev 16586)
+++ search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfiguration.java 2009-05-18 13:21:37 UTC (rev 16587)
@@ -1,4 +1,4 @@
-// $Id: SearchConfiguration.java 14954 2008-07-17 20:43:10Z sannegrinovero $
+// $Id$
package org.hibernate.search.cfg;
import java.util.Iterator;
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfiguration.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java 2009-05-18 13:18:59 UTC (rev 16586)
+++ search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java 2009-05-18 13:21:37 UTC (rev 16587)
@@ -1,4 +1,4 @@
-// $Id: SearchConfigurationFromHibernateCore.java 14954 2008-07-17 20:43:10Z sannegrinovero $
+// $Id$
package org.hibernate.search.cfg;
import java.util.Iterator;
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/SearchConfigurationFromHibernateCore.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/SearchMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/cfg/TokenFilterDefMapping.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/engine/EntityState.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/impl/IndexerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/impl/MappingModelMetadataProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/impl/SimpleIndexingProgressMonitor.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/impl/SolrAnalyzerBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/util/FilterCacheModeTypeHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/main/java/org/hibernate/search/util/HibernateSearchResourceLoader.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/test/java/org/hibernate/search/test/TestCase.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/TestCase.java 2009-05-18 13:18:59 UTC (rev 16586)
+++ search/trunk/src/test/java/org/hibernate/search/test/TestCase.java 2009-05-18 13:21:37 UTC (rev 16587)
@@ -1,4 +1,4 @@
-//$Id: HANTestCase.java 14687 2008-05-22 18:21:01Z epbernard $
+//$Id$
package org.hibernate.search.test;
import java.io.InputStream;
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/analyzer/AlarmEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/analyzer/DoubleAnalyzerTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/test/java/org/hibernate/search/test/analyzer/solr/InsertWhitespaceFilter.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/analyzer/solr/InsertWhitespaceFilter.java 2009-05-18 13:18:59 UTC (rev 16586)
+++ search/trunk/src/test/java/org/hibernate/search/test/analyzer/solr/InsertWhitespaceFilter.java 2009-05-18 13:21:37 UTC (rev 16587)
@@ -1,4 +1,4 @@
-// $Id: AbstractTestAnalyzer.java 15547 2008-11-11 12:57:47Z hardy.ferentschik $
+// $Id$
package org.hibernate.search.test.analyzer.solr;
import java.io.IOException;
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/analyzer/solr/InsertWhitespaceFilter.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/batchindexing/AncientBook.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/batchindexing/Book.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/batchindexing/Dvd.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/batchindexing/ModernBook.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/batchindexing/SearchIndexerTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/classloading/Animal.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/test/java/org/hibernate/search/test/classloading/NoAnnotationsTest.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/classloading/NoAnnotationsTest.java 2009-05-18 13:18:59 UTC (rev 16586)
+++ search/trunk/src/test/java/org/hibernate/search/test/classloading/NoAnnotationsTest.java 2009-05-18 13:21:37 UTC (rev 16587)
@@ -1,4 +1,4 @@
-// $Id: NoAnnotationsTest.java 15532 2008-11-07 16:06:17Z hardy.ferentschik $
+// $Id$
package org.hibernate.search.test.classloading;
import java.util.List;
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/classloading/NoAnnotationsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/configuration/Address.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/configuration/Country.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/configuration/ProgrammaticMappingTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/configuration/User.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/directoryProvider/CustomLockFactoryFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/directoryProvider/CustomLockProviderTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/embedded/NonIndexedEntity.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/embedded/StateCandidate.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/engine/EventListenerSerializationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/filter/AndDocIdSetsTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/filter/FiltersOptimizationTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/filter/InstanceBasedExcludeAllFilter.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/id/Animal.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/id/providedId/ProvidedIdPerson.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/id/providedId/ProvidedIdPersonSub.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/id/providedId/ProvidedIdTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/test/java/org/hibernate/search/test/inheritance/Eagle.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/inheritance/Eagle.java 2009-05-18 13:18:59 UTC (rev 16586)
+++ search/trunk/src/test/java/org/hibernate/search/test/inheritance/Eagle.java 2009-05-18 13:21:37 UTC (rev 16587)
@@ -1,4 +1,4 @@
-//$Id: Fish.java 15592 2008-11-19 14:17:48Z hardy.ferentschik $
+//$Id$
package org.hibernate.search.test.inheritance;
import javax.persistence.Entity;
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/inheritance/Eagle.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/ElectricalProperties.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/worker/duplication/EmailAddress.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/worker/duplication/Person.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/worker/duplication/SpecialPerson.java
___________________________________________________________________
Name: svn:keywords
+ Id
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/worker/duplication/WorkSequencesTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
15 years, 6 months
Hibernate SVN: r16586 - in search/trunk/src: main/java/org/hibernate/search/engine and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-18 09:18:59 -0400 (Mon, 18 May 2009)
New Revision: 16586
Added:
search/trunk/src/main/java/org/hibernate/search/annotations/DynamicBoost.java
search/trunk/src/main/java/org/hibernate/search/engine/BoostStrategy.java
search/trunk/src/main/java/org/hibernate/search/engine/DefaultBoostStrategy.java
search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomBoostStrategy.java
search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomFieldBoostStrategy.java
search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostedDescriptionLibrary.java
search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostingTest.java
Modified:
search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java
search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
search/trunk/src/test/java/org/hibernate/search/test/query/boost/FieldBoostTest.java
Log:
HSEARCH-324
Added a first cut for dynamic boosting using the new DynamicBoost annotation. Needs still documentation.
Added: search/trunk/src/main/java/org/hibernate/search/annotations/DynamicBoost.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/annotations/DynamicBoost.java (rev 0)
+++ search/trunk/src/main/java/org/hibernate/search/annotations/DynamicBoost.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -0,0 +1,29 @@
+//$Id$
+package org.hibernate.search.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.hibernate.search.engine.BoostStrategy;
+
+/**
+ * Apply a dynamic boost factor on a field or a whole entity.
+ *
+ * @author Hardy Ferentschik
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD })
+@Documented
+public @interface DynamicBoost {
+
+ /**
+ * @return An implementation of <code>BoostStrategy</code> to apply a boost
+ * value as function of the annotated object.
+ *
+ * @see org.hibernate.search.engine.BoostStrategy
+ */
+ public abstract Class<? extends BoostStrategy> impl();
+}
\ No newline at end of file
Property changes on: search/trunk/src/main/java/org/hibernate/search/annotations/DynamicBoost.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: search/trunk/src/main/java/org/hibernate/search/engine/BoostStrategy.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/engine/BoostStrategy.java (rev 0)
+++ search/trunk/src/main/java/org/hibernate/search/engine/BoostStrategy.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -0,0 +1,13 @@
+package org.hibernate.search.engine;
+
+/**
+ * Interface to implement boost values as functions
+ * of the object value being boosted.
+ * Implementations must be threadsafe.
+ *
+ * @author Hardy Ferentschik
+ * @see org.hibernate.search.annotations.Boost
+ */
+public interface BoostStrategy {
+ public float defineBoost(Object value);
+}
Property changes on: search/trunk/src/main/java/org/hibernate/search/engine/BoostStrategy.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: search/trunk/src/main/java/org/hibernate/search/engine/DefaultBoostStrategy.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/engine/DefaultBoostStrategy.java (rev 0)
+++ search/trunk/src/main/java/org/hibernate/search/engine/DefaultBoostStrategy.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -0,0 +1,28 @@
+// $Id:$
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.hibernate.search.engine;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class DefaultBoostStrategy implements BoostStrategy {
+
+ public float defineBoost(Object value) {
+ return 1.0f;
+ }
+}
Property changes on: search/trunk/src/main/java/org/hibernate/search/engine/DefaultBoostStrategy.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java 2009-05-18 13:17:55 UTC (rev 16585)
+++ search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderContainedEntity.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -24,7 +24,6 @@
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XMember;
import org.hibernate.annotations.common.reflection.XProperty;
-import org.hibernate.util.StringHelper;
import org.hibernate.search.SearchException;
import org.hibernate.search.analyzer.Discriminator;
import org.hibernate.search.annotations.AnalyzerDef;
@@ -35,6 +34,7 @@
import org.hibernate.search.annotations.ClassBridges;
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.DynamicBoost;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;
@@ -48,6 +48,7 @@
import org.hibernate.search.util.LoggerFactory;
import org.hibernate.search.util.ReflectionHelper;
import org.hibernate.search.util.ScopedAnalyzer;
+import org.hibernate.util.StringHelper;
/**
* Set up and provide a manager for classes which are indexed via <code>@IndexedEmbedded</code>, but themselves do not
@@ -99,6 +100,7 @@
protected void init(XClass clazz, InitContext context) {
metadata.boost = getBoost( clazz );
+ metadata.classBoostStrategy = getDynamicBoost( clazz );
metadata.analyzer = context.getDefaultAnalyzer();
Set<XClass> processedClasses = new HashSet<XClass>();
@@ -195,9 +197,6 @@
}
}
- /**
- * Check for field and method level annotations.
- */
protected void initializeMemberLevelAnnotations(XProperty member, PropertiesMetadata propertiesMetadata, boolean isRoot,
String prefix, Set<XClass> processedClasses, InitContext context) {
checkDocumentId( member, propertiesMetadata, isRoot, prefix, context );
@@ -264,7 +263,7 @@
"Multiple AnalyzerDiscriminator defined in the same class hierarchy: " + beanClass.getName()
);
}
-
+
Class<? extends Discriminator> discriminatorClass = discriminiatorAnn.impl();
try {
propertiesMetadata.discriminator = discriminatorClass.newInstance();
@@ -461,6 +460,7 @@
propertiesMetadata.fieldStore.add( getStore( fieldAnn.store() ) );
propertiesMetadata.fieldIndex.add( getIndex( fieldAnn.index() ) );
propertiesMetadata.fieldBoosts.add( getBoost( member, fieldAnn ) );
+ propertiesMetadata.dynamicFieldBoosts.add( getDynamicBoost( member ) );
propertiesMetadata.fieldTermVectors.add( getTermVector( fieldAnn.termVector() ) );
propertiesMetadata.fieldBridges.add( BridgeFactory.guessType( fieldAnn, member, reflectionManager ) );
@@ -486,6 +486,25 @@
return computedBoost;
}
+ protected BoostStrategy getDynamicBoost(XProperty member) {
+ DynamicBoost boostAnnotation = member.getAnnotation( DynamicBoost.class );
+ if ( boostAnnotation == null ) {
+ return new DefaultBoostStrategy();
+ }
+
+ Class<? extends BoostStrategy> boostStrategyClass = boostAnnotation.impl();
+ BoostStrategy strategy;
+ try {
+ strategy = boostStrategyClass.newInstance();
+ }
+ catch ( Exception e ) {
+ throw new SearchException(
+ "Unable to instantiate boost strategy implementation: " + boostStrategyClass.getName()
+ );
+ }
+ return strategy;
+ }
+
private String buildEmbeddedPrefix(String prefix, IndexedEmbedded embeddedAnn, XProperty member) {
String localPrefix = prefix;
if ( ".".equals( embeddedAnn.prefix() ) ) {
@@ -544,15 +563,40 @@
}
protected Float getBoost(XClass element) {
+ float boost = 1.0f;
if ( element == null ) {
+ return boost;
+ }
+ Boost boostAnnotation = element.getAnnotation( Boost.class );
+ if ( boostAnnotation != null ) {
+ boost = boostAnnotation.value();
+ }
+ return boost;
+ }
+
+ protected BoostStrategy getDynamicBoost(XClass element) {
+ if ( element == null ) {
return null;
}
- Boost boost = element.getAnnotation( Boost.class );
- return boost != null ?
- boost.value() :
- null;
+ DynamicBoost boostAnnotation = element.getAnnotation( DynamicBoost.class );
+ if ( boostAnnotation == null ) {
+ return new DefaultBoostStrategy();
+ }
+
+ Class<? extends BoostStrategy> boostStrategyClass = boostAnnotation.impl();
+ BoostStrategy strategy;
+ try {
+ strategy = boostStrategyClass.newInstance();
+ }
+ catch ( Exception e ) {
+ throw new SearchException(
+ "Unable to instantiate boost strategy implementation: " + boostStrategyClass.getName()
+ );
+ }
+ return strategy;
}
+
//TODO could we use T instead of EntityClass?
public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, WorkType workType, List<LuceneWork> queue, SearchFactoryImplementor searchFactoryImplementor) {
/**
@@ -673,24 +717,31 @@
}
/**
- * Wrapper class containing all the meta data extracted out of the entities.
+ * Wrapper class containing all the meta data extracted out of a single entity.
+ * All field/property related properties are kept in lists. Retrieving all metadata for a given
+ * property/field means accessing all the lists with the same index.
*/
protected static class PropertiesMetadata {
- public Float boost;
+ public float boost;
public Analyzer analyzer;
public Discriminator discriminator;
public XMember discriminatorGetter;
+ public BoostStrategy classBoostStrategy;
+
public final List<String> fieldNames = new ArrayList<String>();
public final List<XMember> fieldGetters = new ArrayList<XMember>();
public final List<FieldBridge> fieldBridges = new ArrayList<FieldBridge>();
public final List<Field.Store> fieldStore = new ArrayList<Field.Store>();
public final List<Field.Index> fieldIndex = new ArrayList<Field.Index>();
public final List<Float> fieldBoosts = new ArrayList<Float>();
+ public final List<BoostStrategy> dynamicFieldBoosts = new ArrayList<BoostStrategy>();
+
public final List<Field.TermVector> fieldTermVectors = new ArrayList<Field.TermVector>();
public final List<XMember> embeddedGetters = new ArrayList<XMember>();
public final List<PropertiesMetadata> embeddedPropertiesMetadata = new ArrayList<PropertiesMetadata>();
public final List<Container> embeddedContainers = new ArrayList<Container>();
public final List<XMember> containedInGetters = new ArrayList<XMember>();
+
public final List<String> classNames = new ArrayList<String>();
public final List<Field.Store> classStores = new ArrayList<Field.Store>();
public final List<Field.Index> classIndexes = new ArrayList<Field.Index>();
@@ -712,13 +763,19 @@
);
}
- protected LuceneOptions getFieldLuceneOptions(int i) {
+ protected LuceneOptions getFieldLuceneOptions(int i, Object value) {
LuceneOptions options;
options = new LuceneOptionsImpl(
fieldStore.get( i ),
- fieldIndex.get( i ), fieldTermVectors.get( i ), fieldBoosts.get( i )
+ fieldIndex.get( i ),
+ fieldTermVectors.get( i ),
+ fieldBoosts.get( i ) * dynamicFieldBoosts.get( i ).defineBoost( value )
);
return options;
}
+
+ protected float getClassBoost(Object value) {
+ return boost * classBoostStrategy.defineBoost( value );
+ }
}
}
\ No newline at end of file
Modified: search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java
===================================================================
--- search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2009-05-18 13:17:55 UTC (rev 16585)
+++ search/trunk/src/main/java/org/hibernate/search/engine/DocumentBuilderIndexedEntity.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -23,7 +23,6 @@
import org.hibernate.annotations.common.reflection.XClass;
import org.hibernate.annotations.common.reflection.XMember;
import org.hibernate.annotations.common.reflection.XProperty;
-import org.hibernate.util.ReflectHelper;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.search.SearchException;
import org.hibernate.search.analyzer.Discriminator;
@@ -48,6 +47,7 @@
import org.hibernate.search.store.IndexShardingStrategy;
import org.hibernate.search.util.LoggerFactory;
import org.hibernate.search.util.ReflectionHelper;
+import org.hibernate.util.ReflectHelper;
/**
* Set up and provide a manager for classes which are directly annotated with <code>@Indexed</code>.
@@ -196,6 +196,7 @@
propertiesMetadata.fieldTermVectors.add( getTermVector( TermVector.NO ) );
propertiesMetadata.fieldBridges.add( BridgeFactory.guessType( null, member, reflectionManager ) );
propertiesMetadata.fieldBoosts.add( getBoost( member, null ) );
+ propertiesMetadata.dynamicFieldBoosts.add( getDynamicBoost( member ) );
// property > entity analyzer (no field analyzer)
Analyzer analyzer = getAnalyzer( member, context );
if ( analyzer == null ) {
@@ -221,28 +222,34 @@
* @return the annotation used as document id or <code>null</code> if id annotation is specified on the property.
*/
private Annotation getIdAnnotation(XProperty member, InitContext context) {
+ Annotation idAnnotation = null;
+
// check for explicit DocumentId
- Annotation documentIdAnn = member.getAnnotation( DocumentId.class );
+ DocumentId documentIdAnn = member.getAnnotation( DocumentId.class );
if ( documentIdAnn != null ) {
explicitDocumentId = true;
- return documentIdAnn;
+ idAnnotation = documentIdAnn;
}
-
// check for JPA @Id
- if ( !explicitDocumentId && context.isJpaPresent() ) {
- Class idClass;
+ else if ( !explicitDocumentId && context.isJpaPresent() ) {
+ Annotation jpaId;
try {
- idClass = org.hibernate.util.ReflectHelper.classForName( "javax.persistence.Id", InitContext.class );
+ @SuppressWarnings("unchecked")
+ Class<? extends Annotation> jpaIdClass = org.hibernate
+ .util
+ .ReflectHelper
+ .classForName( "javax.persistence.Id", InitContext.class );
+ jpaId = member.getAnnotation( jpaIdClass );
}
catch ( ClassNotFoundException e ) {
throw new SearchException( "Unable to load @Id.class even though it should be present ?!" );
}
- documentIdAnn = member.getAnnotation( idClass );
- if ( documentIdAnn != null ) {
+ if ( jpaId != null ) {
log.debug( "Found JPA id and using it as document id" );
+ idAnnotation = jpaId;
}
}
- return documentIdAnn;
+ return idAnnotation;
}
private ProvidedId findProvidedId(XClass clazz, ReflectionManager reflectionManager) {
@@ -258,7 +265,7 @@
//TODO could we use T instead of EntityClass?
public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, WorkType workType, List<LuceneWork> queue, SearchFactoryImplementor searchFactoryImplementor) {
//TODO with the caller loop we are in a n^2: optimize it using a HashMap for work recognition
-
+
boolean sameIdWasSetToBeDeleted = false;
List<LuceneWork> toDelete = new ArrayList<LuceneWork>();
boolean duplicateDelete = false;
@@ -301,7 +308,7 @@
//avoid updating (and thus adding) objects which are going to be deleted
return;
}
-
+
for ( LuceneWork luceneWork : toDelete ) {
queue.remove( luceneWork );
}
@@ -367,9 +374,7 @@
Document doc = new Document();
final Class<?> entityType = Hibernate.getClass( instance );
- if ( metadata.boost != null ) {
- doc.setBoost( metadata.boost );
- }
+ doc.setBoost( metadata.getClassBoost( instance ) );
// add the class name of the entity to the document
Field classField =
@@ -419,7 +424,7 @@
Object value = ReflectionHelper.getMemberValue( unproxiedInstance, member );
propertiesMetadata.fieldBridges.get( i ).set(
propertiesMetadata.fieldNames.get( i ), value, doc,
- propertiesMetadata.getFieldLuceneOptions( i )
+ propertiesMetadata.getFieldLuceneOptions( i, value )
);
}
Added: search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomBoostStrategy.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomBoostStrategy.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomBoostStrategy.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -0,0 +1,19 @@
+//$Id$
+package org.hibernate.search.test.query.boost;
+
+import org.hibernate.search.engine.BoostStrategy;
+
+/**
+ * Example for a custom <code>BoostStrategy</code> implementation.
+ *
+ * @author Sanne Grinovero
+ * @author Hardy Ferentschik
+ * @see org.hibernate.search.engine.BoostStrategy
+ */
+public class CustomBoostStrategy implements BoostStrategy {
+
+ public float defineBoost(Object value) {
+ DynamicBoostedDescriptionLibrary indexed = ( DynamicBoostedDescriptionLibrary ) value;
+ return indexed.getDynScore();
+ }
+}
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomBoostStrategy.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomFieldBoostStrategy.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomFieldBoostStrategy.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomFieldBoostStrategy.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -0,0 +1,23 @@
+//$Id$
+package org.hibernate.search.test.query.boost;
+
+import org.hibernate.search.engine.BoostStrategy;
+
+/**
+ * Example for a custom <code>BoostStrategy</code> implementation.
+ *
+ * @author Hardy Ferentschik
+ * @see org.hibernate.search.engine.BoostStrategy
+ */
+public class CustomFieldBoostStrategy implements BoostStrategy {
+
+ public float defineBoost(Object value) {
+ String name = ( String ) value;
+ if ( "foobar".equals( name ) ) {
+ return 3.0f;
+ }
+ else {
+ return 1.0f;
+ }
+ }
+}
\ No newline at end of file
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/CustomFieldBoostStrategy.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostedDescriptionLibrary.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostedDescriptionLibrary.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostedDescriptionLibrary.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -0,0 +1,63 @@
+//$Id$
+package org.hibernate.search.test.query.boost;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import org.hibernate.search.annotations.Boost;
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.Store;
+import org.hibernate.search.annotations.DynamicBoost;
+
+/**
+ * Test entity using a custom <code>CustomBoostStrategy</code> to set
+ * the document boost as the dynScore field.
+ *
+ * @author Sanne Grinovero
+ * @author Hardy Ferentschik
+ */
+@Entity
+@Indexed
+@DynamicBoost(impl = CustomBoostStrategy.class)
+public class DynamicBoostedDescriptionLibrary {
+
+ private int id;
+ private float dynScore;
+ private String name;
+
+ public DynamicBoostedDescriptionLibrary() {
+ dynScore = 1.0f;
+ }
+
+ @Id
+ @GeneratedValue
+ @DocumentId
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public float getDynScore() {
+ return dynScore;
+ }
+
+ public void setDynScore(float dynScore) {
+ this.dynScore = dynScore;
+ }
+
+ @Field(store = Store.YES)
+ @DynamicBoost(impl = CustomFieldBoostStrategy.class)
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostedDescriptionLibrary.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostingTest.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostingTest.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostingTest.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -0,0 +1,109 @@
+//$Id$
+package org.hibernate.search.test.query.boost;
+
+import java.util.List;
+
+import org.apache.lucene.index.Term;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.TermQuery;
+import org.slf4j.Logger;
+
+import org.hibernate.Session;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.ProjectionConstants;
+import org.hibernate.search.Search;
+import org.hibernate.search.test.SearchTestCase;
+import org.hibernate.search.util.LoggerFactory;
+
+public class DynamicBoostingTest extends SearchTestCase {
+
+ private static final Logger log = LoggerFactory.make();
+
+ public void testDynamicBoosts() throws Exception {
+
+ Session session = openSession();
+ session.beginTransaction();
+
+ DynamicBoostedDescriptionLibrary lib1 = new DynamicBoostedDescriptionLibrary();
+ lib1.setName( "one" );
+ session.persist( lib1 );
+
+ DynamicBoostedDescriptionLibrary lib2 = new DynamicBoostedDescriptionLibrary();
+ lib2.setName( "two" );
+ session.persist( lib2 );
+
+ session.getTransaction().commit();
+ session.close();
+
+ float lib1Score = getScore( new TermQuery( new Term( "name", "one" ) ) );
+ float lib2Score = getScore( new TermQuery( new Term( "name", "two" ) ) );
+ assertEquals( "The scores should be equal", lib1Score, lib2Score );
+
+ // set dynamic score and reindex!
+ session = openSession();
+ session.beginTransaction();
+
+ session.refresh( lib2 );
+ lib2.setDynScore( 2.0f );
+
+ session.getTransaction().commit();
+ session.close();
+
+ lib1Score = getScore( new TermQuery( new Term( "name", "one" ) ) );
+ lib2Score = getScore( new TermQuery( new Term( "name", "two" ) ) );
+ assertTrue( "lib2score should be greater than lib1score", lib1Score < lib2Score );
+
+
+
+ lib1Score = getScore( new TermQuery( new Term( "name", "foobar" ) ) );
+ assertEquals( "lib1score should be 0 since term is not yet indexed.", 0.0f, lib1Score );
+
+ // index foobar
+ session = openSession();
+ session.beginTransaction();
+
+ session.refresh( lib1 );
+ lib1.setName( "foobar" );
+
+ session.getTransaction().commit();
+ session.close();
+
+ lib1Score = getScore( new TermQuery( new Term( "name", "foobar" ) ) );
+ lib2Score = getScore( new TermQuery( new Term( "name", "two" ) ) );
+ assertTrue( "lib1score should be greater than lib2score", lib1Score > lib2Score );
+ }
+
+ private float getScore(Query query) {
+ Session session = openSession();
+ Object[] queryResult;
+ float score;
+ try {
+ FullTextSession fullTextSession = Search.getFullTextSession( session );
+ List resultList = fullTextSession
+ .createFullTextQuery( query, DynamicBoostedDescriptionLibrary.class )
+ .setProjection( ProjectionConstants.SCORE, ProjectionConstants.EXPLANATION )
+ .setMaxResults( 1 )
+ .list();
+
+ if ( resultList.size() == 0 ) {
+ score = 0.0f;
+ }
+ else {
+ queryResult = ( Object[] ) resultList.get( 0 );
+ score = ( Float ) queryResult[0];
+ String explanation = queryResult[1].toString();
+ log.debug( "score: " + score + " explanation: " + explanation );
+ }
+ }
+ finally {
+ session.close();
+ }
+ return score;
+ }
+
+ protected Class[] getMappings() {
+ return new Class[] {
+ DynamicBoostedDescriptionLibrary.class
+ };
+ }
+}
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/DynamicBoostingTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: search/trunk/src/test/java/org/hibernate/search/test/query/boost/FieldBoostTest.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/FieldBoostTest.java 2009-05-18 13:17:55 UTC (rev 16585)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/FieldBoostTest.java 2009-05-18 13:18:59 UTC (rev 16586)
@@ -1,3 +1,4 @@
+//$Id$
package org.hibernate.search.test.query.boost;
import java.util.List;
@@ -7,17 +8,21 @@
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query;
+import org.slf4j.Logger;
import org.hibernate.Transaction;
import org.hibernate.search.FullTextSession;
import org.hibernate.search.Search;
import org.hibernate.search.test.SearchTestCase;
+import org.hibernate.search.util.LoggerFactory;
/**
* @author John Griffin
*/
-public class FieldBoostTest extends SearchTestCase {
+public class FieldBoostTest extends SearchTestCase {
+ private static final Logger log = LoggerFactory.make();
+
public void testBoostedGetDesc() throws Exception {
FullTextSession fullTextSession = Search.getFullTextSession( openSession() );
buildBoostedGetIndex( fullTextSession );
@@ -33,14 +38,14 @@
BooleanQuery query = new BooleanQuery();
query.add( author, BooleanClause.Occur.SHOULD );
query.add( desc, BooleanClause.Occur.SHOULD );
- //System.out.println( query.toString() );
+ log.debug( query.toString() );
org.hibernate.search.FullTextQuery hibQuery =
fullTextSession.createFullTextQuery( query, BoostedGetDescriptionLibrary.class );
List results = hibQuery.list();
- //System.out.println( hibQuery.explain( 0 ) );
- //System.out.println( hibQuery.explain( 1 ) );
+ log.debug( hibQuery.explain( 0 ).toString() );
+ log.debug( hibQuery.explain( 1 ).toString() );
assertTrue(
"incorrect document returned",
@@ -71,7 +76,7 @@
BooleanQuery query = new BooleanQuery();
query.add( author, BooleanClause.Occur.SHOULD );
query.add( desc, BooleanClause.Occur.SHOULD );
- //System.out.println( query.toString() );
+ log.debug( query.toString() );
org.hibernate.search.FullTextQuery hibQuery =
fullTextSession.createFullTextQuery( query, BoostedFieldDescriptionLibrary.class );
@@ -82,8 +87,8 @@
( ( BoostedFieldDescriptionLibrary ) results.get( 0 ) ).getDescription().startsWith( "Martians" )
);
- //System.out.println( hibQuery.explain( 0 ) );
- //System.out.println( hibQuery.explain( 1 ) );
+ log.debug( hibQuery.explain( 0 ).toString() );
+ log.debug( hibQuery.explain( 1 ).toString() );
//cleanup
for ( Object element : fullTextSession.createQuery( "from " + BoostedFieldDescriptionLibrary.class.getName() )
@@ -109,14 +114,14 @@
BooleanQuery query = new BooleanQuery();
query.add( author, BooleanClause.Occur.SHOULD );
query.add( desc, BooleanClause.Occur.SHOULD );
- //System.out.println( query.toString() );
+ log.debug( query.toString() );
org.hibernate.search.FullTextQuery hibQuery =
fullTextSession.createFullTextQuery( query, BoostedDescriptionLibrary.class );
List results = hibQuery.list();
- //System.out.println( hibQuery.explain( 0 ) );
- //System.out.println( hibQuery.explain( 1 ) );
+ log.debug( hibQuery.explain( 0 ).toString() );
+ log.debug( hibQuery.explain( 1 ).toString() );
assertTrue(
"incorrect document returned",
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/FieldBoostTest.java
___________________________________________________________________
Name: svn:keywords
+ Id
15 years, 6 months
Hibernate SVN: r16585 - search/trunk/src/test/java/org/hibernate/search/test/query/boost.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-05-18 09:17:55 -0400 (Mon, 18 May 2009)
New Revision: 16585
Modified:
search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedDescriptionLibrary.java
search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedFieldDescriptionLibrary.java
search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedGetDescriptionLibrary.java
search/trunk/src/test/java/org/hibernate/search/test/query/boost/Library.java
Log:
Some cleanup and setting of svn properties
Modified: search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedDescriptionLibrary.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedDescriptionLibrary.java 2009-05-18 12:48:42 UTC (rev 16584)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedDescriptionLibrary.java 2009-05-18 13:17:55 UTC (rev 16585)
@@ -1,3 +1,4 @@
+//$Id$
package org.hibernate.search.test.query.boost;
import javax.persistence.Entity;
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedDescriptionLibrary.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedFieldDescriptionLibrary.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedFieldDescriptionLibrary.java 2009-05-18 12:48:42 UTC (rev 16584)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedFieldDescriptionLibrary.java 2009-05-18 13:17:55 UTC (rev 16585)
@@ -1,3 +1,4 @@
+//$Id$
package org.hibernate.search.test.query.boost;
import javax.persistence.Entity;
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedFieldDescriptionLibrary.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedGetDescriptionLibrary.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedGetDescriptionLibrary.java 2009-05-18 12:48:42 UTC (rev 16584)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedGetDescriptionLibrary.java 2009-05-18 13:17:55 UTC (rev 16585)
@@ -1,3 +1,4 @@
+//$Id$
package org.hibernate.search.test.query.boost;
import javax.persistence.Entity;
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/BoostedGetDescriptionLibrary.java
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: search/trunk/src/test/java/org/hibernate/search/test/query/boost/Library.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/query/boost/Library.java 2009-05-18 12:48:42 UTC (rev 16584)
+++ search/trunk/src/test/java/org/hibernate/search/test/query/boost/Library.java 2009-05-18 13:17:55 UTC (rev 16585)
@@ -1,3 +1,4 @@
+//$Id$
package org.hibernate.search.test.query.boost;
import javax.persistence.Entity;
Property changes on: search/trunk/src/test/java/org/hibernate/search/test/query/boost/Library.java
___________________________________________________________________
Name: svn:keywords
+ Id
15 years, 6 months
Hibernate SVN: r16584 - branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml.
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2009-05-18 08:48:42 -0400 (Mon, 18 May 2009)
New Revision: 16584
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java
Log:
remove wrong license header.
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java 2009-05-18 12:45:43 UTC (rev 16583)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java 2009-05-18 12:48:42 UTC (rev 16584)
@@ -1,13 +1,4 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+
package org.hibernate.tool.hbm2x.hbm2hbmxml;
import org.hibernate.mapping.JoinedSubclass;
15 years, 6 months
Hibernate SVN: r16583 - in branches/Branch_3_2/HibernateExt/tools/src: test/org/hibernate/tool/hbm2x/hbm2hbmxml and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2009-05-18 08:45:43 -0400 (Mon, 18 May 2009)
New Revision: 16583
Added:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java
Modified:
branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmAllTests.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-3914
Modified: branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java 2009-05-18 12:14:54 UTC (rev 16582)
+++ branches/Branch_3_2/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/Cfg2HbmTool.java 2009-05-18 12:45:43 UTC (rev 16583)
@@ -390,8 +390,30 @@
public boolean needsTable(PersistentClass clazz) {
- return !(clazz instanceof org.hibernate.mapping.Subclass
- && clazz instanceof org.hibernate.mapping.SingleTableSubclass);
+ Boolean accept = (Boolean) clazz.accept(new PersistentClassVisitor(){
+
+ public Object accept(Subclass subclass) {
+ return Boolean.FALSE;
+ }
+
+ public Object accept(JoinedSubclass subclass) {
+ return Boolean.TRUE;
+ }
+
+ public Object accept(SingleTableSubclass subclass) {
+ return Boolean.FALSE;
+ }
+
+ public Object accept(UnionSubclass subclass) {
+ return Boolean.TRUE;
+ }
+
+ public Object accept(RootClass class1) {
+ return Boolean.TRUE;
+ }
+ });
+
+ return accept.booleanValue();
}
public boolean isSubclass(PersistentClass clazz) {
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmAllTests.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmAllTests.java 2009-05-18 12:14:54 UTC (rev 16582)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmAllTests.java 2009-05-18 12:45:43 UTC (rev 16583)
@@ -19,6 +19,7 @@
suite.addTest(InheritanceTest.suite());
suite.addTest(SetElementTest.suite());
suite.addTest(BackrefTest.suite());
+ suite.addTest(Cfg2HbmToolTest.suite());
//$JUnit-END$
return suite;
}
Added: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java (rev 0)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/hbm2hbmxml/Cfg2HbmToolTest.java 2009-05-18 12:45:43 UTC (rev 16583)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.tool.hbm2x.hbm2hbmxml;
+
+import org.hibernate.mapping.JoinedSubclass;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.RootClass;
+import org.hibernate.mapping.SingleTableSubclass;
+import org.hibernate.mapping.Subclass;
+import org.hibernate.mapping.UnionSubclass;
+import org.hibernate.tool.hbm2x.Cfg2HbmTool;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class Cfg2HbmToolTest extends TestCase {
+
+ public void testNeedsTable(){
+ Cfg2HbmTool c2h = new Cfg2HbmTool();
+ PersistentClass pc = new RootClass();
+ assertTrue(c2h.needsTable(pc));
+ assertTrue(c2h.needsTable(new JoinedSubclass(pc)));
+ assertTrue(c2h.needsTable(new UnionSubclass(pc)));
+ assertFalse(c2h.needsTable(new SingleTableSubclass(pc)));
+ assertFalse(c2h.needsTable(new Subclass(pc)));
+
+ }
+
+ public static Test suite() {
+ return new TestSuite(Cfg2HbmToolTest.class);
+ }
+
+}
15 years, 6 months
Hibernate SVN: r16582 - in branches/Branch_3_2/HibernateExt/tools: lib/jdbc and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2009-05-18 08:14:54 -0400 (Mon, 18 May 2009)
New Revision: 16582
Added:
branches/Branch_3_2/HibernateExt/tools/lib/jdbc/
branches/Branch_3_2/HibernateExt/tools/lib/jdbc/hsqldb.jar
Modified:
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java
branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/JavaFormatterTest.java
branches/Branch_3_2/HibernateExt/tools/src/testsupport/anttest-build.xml
branches/Branch_3_2/HibernateExt/tools/src/testsupport/javaformattest-build.xml
Log:
added missing lib and cleanup code for reliable test runs
Added: branches/Branch_3_2/HibernateExt/tools/lib/jdbc/hsqldb.jar
===================================================================
(Binary files differ)
Property changes on: branches/Branch_3_2/HibernateExt/tools/lib/jdbc/hsqldb.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java 2009-05-18 02:06:36 UTC (rev 16581)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/AntHibernateToolTest.java 2009-05-18 12:14:54 UTC (rev 16582)
@@ -33,7 +33,9 @@
super.tearDown();
}
protected void setUp() throws Exception {
+ super.setUp();
configureProject("src/testsupport/anttest-build.xml");
+ executeTarget( "cleanup" );
}
public void testHbm2DDLLogic() {
Modified: branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/JavaFormatterTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/JavaFormatterTest.java 2009-05-18 02:06:36 UTC (rev 16581)
+++ branches/Branch_3_2/HibernateExt/tools/src/test/org/hibernate/tool/ant/JavaFormatterTest.java 2009-05-18 12:14:54 UTC (rev 16582)
@@ -30,7 +30,9 @@
super.tearDown();
}
protected void setUp() throws Exception {
+ super.setUp();
configureProject("src/testsupport/javaformattest-build.xml");
+ executeTarget( "cleanup" );
}
public void testJava() {
Modified: branches/Branch_3_2/HibernateExt/tools/src/testsupport/anttest-build.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/testsupport/anttest-build.xml 2009-05-18 02:06:36 UTC (rev 16581)
+++ branches/Branch_3_2/HibernateExt/tools/src/testsupport/anttest-build.xml 2009-05-18 12:14:54 UTC (rev 16582)
@@ -17,7 +17,9 @@
</path>
- <target name="cleanup" description="task used for ensuring cleanup to be done even in the case of test failure" depends="afterCfg2hbm"/>
+ <target name="cleanup" description="task used for ensuring cleanup to be done even in the case of test failure" depends="afterCfg2hbm">
+ <delete dir="${build.dir}"/>
+ </target>
<target name="testScriptCreation">
Modified: branches/Branch_3_2/HibernateExt/tools/src/testsupport/javaformattest-build.xml
===================================================================
--- branches/Branch_3_2/HibernateExt/tools/src/testsupport/javaformattest-build.xml 2009-05-18 02:06:36 UTC (rev 16581)
+++ branches/Branch_3_2/HibernateExt/tools/src/testsupport/javaformattest-build.xml 2009-05-18 12:14:54 UTC (rev 16582)
@@ -1,7 +1,5 @@
<project name="javaformattest">
- <property name="hibernate-core.jar" location="../../../../hibernate-3.1/hibernate3.jar" />
- <property name="hibernate-core.home" location="../../../../Hibernate3" />
- <property name="hibernate-core.lib.dir" location="${hibernate-core.home}/lib" />
+ <property name="hibernate-libs" location="../../lib/testlibs" />
<property name="build.dir" location="../../build/javaformattest" />
<property file="../../etc/hibernate.properties" />
@@ -11,17 +9,16 @@
<pathelement path="../../build/eclipse" />
<pathelement path="../../build/classes" />
- <fileset dir="${hibernate-core.lib.dir}">
+ <fileset dir="${hibernate-libs}">
<include name="**/*.jar" />
</fileset>
- <pathelement location="${hibernate-core.jar}" />
<pathelement path="../../lib/freemarker.jar" />
<fileset dir="../../lib">
<include name="**/*eclipse*.jar" />
</fileset>
- <pathelement path="${hibernate-core.home}\jdbc\hsqldb.jar" />
+ <pathelement path="../../../lib/hsqldb.jar" />
</path>
<target name="cleanup">
15 years, 6 months