Author: epbernard
Date: 2007-07-30 20:46:10 -0400 (Mon, 30 Jul 2007)
New Revision: 12857
Added:
trunk/HibernateExt/search/src/test/org/hibernate/search/test/shards/Furniture.java
Modified:
trunk/HibernateExt/search/src/test/org/hibernate/search/test/shards/ShardsTest.java
Log:
HSEARCH-86 more test on sharding
Added: trunk/HibernateExt/search/src/test/org/hibernate/search/test/shards/Furniture.java
===================================================================
--- trunk/HibernateExt/search/src/test/org/hibernate/search/test/shards/Furniture.java
(rev 0)
+++
trunk/HibernateExt/search/src/test/org/hibernate/search/test/shards/Furniture.java 2007-07-31
00:46:10 UTC (rev 12857)
@@ -0,0 +1,38 @@
+//$Id$
+package org.hibernate.search.test.shards;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Field;
+
+/**
+ * @author Emmanuel Bernard
+ */
+@Entity
+@Indexed
+public class Furniture {
+ @Id @GeneratedValue @DocumentId
+ private Integer id;
+ @Field
+ private String color;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getColor() {
+ return color;
+ }
+
+ public void setColor(String color) {
+ this.color = color;
+ }
+}
Modified:
trunk/HibernateExt/search/src/test/org/hibernate/search/test/shards/ShardsTest.java
===================================================================
---
trunk/HibernateExt/search/src/test/org/hibernate/search/test/shards/ShardsTest.java 2007-07-31
00:13:51 UTC (rev 12856)
+++
trunk/HibernateExt/search/src/test/org/hibernate/search/test/shards/ShardsTest.java 2007-07-31
00:46:10 UTC (rev 12857)
@@ -66,6 +66,9 @@
tx = s.beginTransaction();
a = (Animal) s.get(Animal.class, 1);
a.setName( "Mouse" );
+ Furniture fur = new Furniture();
+ fur.setColor( "dark blue");
+ s.persist( fur );
tx.commit();
s.clear();
@@ -76,6 +79,11 @@
List results = fts.createFullTextQuery( parser.parse( "name:mouse OR
name:bear" ) ).list();
assertEquals( "Either double insert, single update, or query fails with
shards", 2, results.size() );
+
+ results = fts.createFullTextQuery( parser.parse( "name:mouse OR name:bear OR
color:blue" ) ).list();
+ assertEquals( "Mixing shared and non sharded properties fails", 3,
results.size() );
+ results = fts.createFullTextQuery( parser.parse( "name:mouse OR name:bear OR
color:blue" ) ).list();
+ assertEquals( "Mixing shared and non sharded properties fails with indexreader
reuse", 3, results.size() );
for (Object o : results) s.delete( o );
tx.commit();
s.close();
@@ -184,7 +192,8 @@
protected Class[] getMappings() {
return new Class[] {
- Animal.class
+ Animal.class,
+ Furniture.class
};
}
}
Show replies by date