Author: hardy.ferentschik
Date: 2010-08-25 06:33:27 -0400 (Wed, 25 Aug 2010)
New Revision: 20260
Modified:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/Document.java
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/RamDirectoryTest.java
Log:
HSEARCH-589 Default constructor in Document is needed.
Modified:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/Document.java
===================================================================
---
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/Document.java 2010-08-25
10:32:57 UTC (rev 20259)
+++
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/Document.java 2010-08-25
10:33:27 UTC (rev 20260)
@@ -42,6 +42,9 @@
private String summary;
private String text;
+ public Document() {
+ }
+
public Document(String title, String summary, String text) {
super();
this.summary = summary;
Modified:
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/RamDirectoryTest.java
===================================================================
---
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/RamDirectoryTest.java 2010-08-25
10:32:57 UTC (rev 20259)
+++
search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/RamDirectoryTest.java 2010-08-25
10:33:27 UTC (rev 20260)
@@ -1,51 +1,54 @@
-/* $Id$
- *
+/*
* Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2009, Red Hat, Inc. and/or its affiliates or third-party contributors
as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat, Inc.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
+ *
+ * Copyright (c) 2010, Red Hat, Inc. and/or its affiliates or third-party contributors
as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat, Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
*/
package org.hibernate.search.test;
-import org.hibernate.Session;
-import org.hibernate.search.Search;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.TermQuery;
+import org.hibernate.Session;
+import org.hibernate.search.Search;
+
/**
* @author Emmanuel Bernard
*/
public class RamDirectoryTest extends SearchTestCase {
public void testMultipleEntitiesPerIndex() throws Exception {
-
-
Session s = getSessions().openSession();
s.getTransaction().begin();
Document document =
new Document( "Hibernate in Action", "Object/relational mapping with
Hibernate", "blah blah blah" );
- s.persist(document);
+ s.persist( document );
s.flush();
s.persist(
- new AlternateDocument( document.getId(), "Hibernate in Action",
"Object/relational mapping with Hibernate", "blah blah blah" )
+ new AlternateDocument(
+ document.getId(),
+ "Hibernate in Action",
+ "Object/relational mapping with Hibernate",
+ "blah blah blah"
+ )
);
s.getTransaction().commit();
s.close();
@@ -54,11 +57,17 @@
s = getSessions().openSession();
s.getTransaction().begin();
- TermQuery q = new TermQuery(new Term("alt_title", "hibernate"));
- assertEquals( "does not properly filter", 0,
- Search.getFullTextSession( s ).createFullTextQuery( q, Document.class ).list().size()
);
- assertEquals( "does not properly filter", 1,
- Search.getFullTextSession( s ).createFullTextQuery( q, Document.class,
AlternateDocument.class ).list().size() );
+ TermQuery q = new TermQuery( new Term( "alt_title", "hibernate" )
);
+ assertEquals(
+ "does not properly filter", 0,
+ Search.getFullTextSession( s ).createFullTextQuery( q, Document.class
).list().size()
+ );
+ assertEquals(
+ "does not properly filter", 1,
+ Search.getFullTextSession( s )
+ .createFullTextQuery( q, Document.class, AlternateDocument.class )
+ .list().size()
+ );
s.delete( s.get( AlternateDocument.class, document.getId() ) );
s.getTransaction().commit();
s.close();
@@ -83,10 +92,9 @@
}
protected Class<?>[] getAnnotatedClasses() {
- return new Class[]{
+ return new Class[] {
Document.class,
AlternateDocument.class
};
}
-
}