[hibernate-commits] Hibernate SVN: r18489 - in search/trunk: src/test/java/org/hibernate/search/test/embedded and 2 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Sat Jan 9 14:47:30 EST 2010
Author: hardy.ferentschik
Date: 2010-01-09 14:47:29 -0500 (Sat, 09 Jan 2010)
New Revision: 18489
Added:
search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Product.java
Removed:
search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Product.java
Modified:
search/trunk/pom.xml
search/trunk/src/test/java/org/hibernate/search/test/embedded/Address.java
search/trunk/src/test/java/org/hibernate/search/test/embedded/Country.java
search/trunk/src/test/java/org/hibernate/search/test/embedded/State.java
search/trunk/src/test/java/org/hibernate/search/test/embedded/Tower.java
search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Attribute.java
search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Place.java
search/trunk/src/test/java/org/hibernate/search/test/engine/BusLine.java
search/trunk/src/test/java/org/hibernate/search/test/engine/BusStop.java
Log:
HSEARCH-408 changed test data setup to allow formode once
Modified: search/trunk/pom.xml
===================================================================
--- search/trunk/pom.xml 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/pom.xml 2010-01-09 19:47:29 UTC (rev 18489)
@@ -161,7 +161,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>pertest</forkMode>
+ <forkMode>once</forkMode>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<systemProperties>
<property>
@@ -801,7 +801,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>pertest</forkMode>
+ <forkMode>once</forkMode>
+ <!--argLine>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</argLine-->
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<excludes>
<exclude>**/classloading/*.java</exclude>
@@ -828,7 +829,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <forkMode>pertest</forkMode>
+ <forkMode>once</forkMode>
+ <!--argLine>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</argLine-->
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<excludes>
<exclude>none</exclude>
Modified: search/trunk/src/test/java/org/hibernate/search/test/embedded/Address.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/embedded/Address.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/embedded/Address.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -26,20 +26,20 @@
import java.util.HashSet;
import java.util.Set;
+import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
-import javax.persistence.CascadeType;
+import org.hibernate.annotations.Target;
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
-import org.hibernate.annotations.Target;
/**
* @author Emmanuel Bernard
@@ -53,7 +53,7 @@
@DocumentId
private Long id;
- @Field(index= Index.TOKENIZED)
+ @Field(index = Index.TOKENIZED)
private String street;
@IndexedEmbedded(depth = 1, prefix = "ownedBy_", targetElement = Owner.class)
@@ -64,19 +64,10 @@
@ContainedIn
private Set<Tower> towers = new HashSet<Tower>();
- public Country getCountry() {
- return country;
- }
-
- public void setCountry(Country country) {
- this.country = country;
- }
-
- @ManyToOne(cascade = { CascadeType.PERSIST })
+ @ManyToOne(cascade = CascadeType.ALL)
@IndexedEmbedded
private Country country;
-
public Long getId() {
return id;
}
@@ -109,4 +100,12 @@
public void setTowers(Set<Tower> towers) {
this.towers = towers;
}
+
+ public Country getCountry() {
+ return country;
+ }
+
+ public void setCountry(Country country) {
+ this.country = country;
+ }
}
Modified: search/trunk/src/test/java/org/hibernate/search/test/embedded/Country.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/embedded/Country.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/embedded/Country.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -26,14 +26,13 @@
import java.util.ArrayList;
import java.util.List;
-
+import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
-import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.IndexColumn;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
@@ -54,10 +53,9 @@
@Field
private String name;
- @OneToMany(fetch = FetchType.LAZY)
+ @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
//FIXME with JPA 2, move to @OrderColumn
@IndexColumn(name = "list_position")
- @Cascade(org.hibernate.annotations.CascadeType.ALL)
@IndexedEmbedded
private List<State> states = new ArrayList<State>();
Modified: search/trunk/src/test/java/org/hibernate/search/test/embedded/State.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/embedded/State.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/embedded/State.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -24,6 +24,7 @@
*/
package org.hibernate.search.test.embedded;
+import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@@ -47,7 +48,7 @@
private String name;
@ContainedIn
- @OneToOne(mappedBy = "state")
+ @OneToOne(mappedBy = "state", cascade = CascadeType.ALL)
private StateCandidate candidate;
public Integer getId() {
Modified: search/trunk/src/test/java/org/hibernate/search/test/embedded/Tower.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/embedded/Tower.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/embedded/Tower.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -47,10 +47,10 @@
@DocumentId
private Long id;
- @Field( index = Index.TOKENIZED )
+ @Field(index = Index.TOKENIZED)
private String name;
- @ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.REMOVE } )
+ @ManyToOne(cascade = CascadeType.ALL)
@IndexedEmbedded
private Address address;
Modified: search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Attribute.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Attribute.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Attribute.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -51,7 +51,7 @@
@ContainedIn
private Product product;
- @OneToMany(mappedBy = "attribute", fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
+ @OneToMany(mappedBy = "attribute", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@IndexedEmbedded
private List<AttributeValue> values;
Modified: search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Place.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Place.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Place.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -50,7 +50,7 @@
@Field(index = Index.TOKENIZED)
private String name;
- @OneToOne(cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
+ @OneToOne(cascade = CascadeType.ALL)
@IndexedEmbedded
private Address address;
Deleted: search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Product.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Product.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Product.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -1,68 +0,0 @@
-/* $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
- */
-package org.hibernate.search.test.embedded.nested;
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-
-import org.hibernate.search.annotations.Indexed;
-import org.hibernate.search.annotations.IndexedEmbedded;
-
-/**
- * @author Hardy Ferentschik
- */
- at Entity
- at Indexed
-public class Product {
- @Id
- @GeneratedValue
- private long id;
-
- @OneToMany(mappedBy = "product", fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
- @IndexedEmbedded
- private List<Attribute> attributes;
-
- public Product() {
- attributes = new ArrayList<Attribute>();
- }
-
- public long getId() {
- return id;
- }
-
- public List<Attribute> getAttributes() {
- return attributes;
- }
-
- public void setAttribute(Attribute attribute) {
- attributes.add( attribute );
- }
-}
Added: search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Product.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Product.java (rev 0)
+++ search/trunk/src/test/java/org/hibernate/search/test/embedded/nested/Product.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -0,0 +1,68 @@
+/* $Id: Product.java 17630 2009-10-06 13:38:43Z sannegrinovero $
+ *
+ * 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
+ */
+package org.hibernate.search.test.embedded.nested;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.IndexedEmbedded;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+ at Indexed
+public class Product {
+ @Id
+ @GeneratedValue
+ private long id;
+
+ @OneToMany(mappedBy = "product", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
+ @IndexedEmbedded
+ private List<Attribute> attributes;
+
+ public Product() {
+ attributes = new ArrayList<Attribute>();
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public List<Attribute> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttribute(Attribute attribute) {
+ attributes.add( attribute );
+ }
+}
Modified: search/trunk/src/test/java/org/hibernate/search/test/engine/BusLine.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/engine/BusLine.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/engine/BusLine.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -26,7 +26,6 @@
import java.util.HashSet;
import java.util.Set;
-
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
@@ -42,19 +41,19 @@
/**
* Test entity: BusLine have many BusStops: needed to verify
* indexing of a lazy-loaded collection in out-of-transaction use case.
- *
+ *
* @author Sanne Grinovero
*/
@Entity
@Indexed
public class BusLine {
-
+
private Long id;
private String busLineName;
private Set<BusStop> stops = new HashSet<BusStop>();
@Id
- @GeneratedValue
+ @GeneratedValue
public Long getId() {
return id;
}
@@ -63,7 +62,7 @@
this.id = id;
}
- @Field(index=Index.NO,store=Store.YES)
+ @Field(index = Index.NO, store = Store.YES)
public String getBusLineName() {
return busLineName;
}
@@ -72,12 +71,12 @@
this.busLineName = busLine;
}
- @ManyToMany(cascade=CascadeType.PERSIST)
+ @ManyToMany(cascade = CascadeType.ALL)
@IndexedEmbedded
public Set<BusStop> getStops() {
return stops;
}
-
+
public void setStops(Set<BusStop> stops) {
this.stops = stops;
}
@@ -86,25 +85,31 @@
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((busLineName == null) ? 0 : busLineName.hashCode());
+ result = prime * result + ( ( busLineName == null ) ? 0 : busLineName.hashCode() );
return result;
}
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if ( this == obj ) {
return true;
- if (obj == null)
+ }
+ if ( obj == null ) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if ( getClass() != obj.getClass() ) {
return false;
- BusLine other = (BusLine) obj;
- if (busLineName == null) {
- if (other.busLineName != null)
+ }
+ BusLine other = ( BusLine ) obj;
+ if ( busLineName == null ) {
+ if ( other.busLineName != null ) {
return false;
- } else if (!busLineName.equals(other.busLineName))
+ }
+ }
+ else if ( !busLineName.equals( other.busLineName ) ) {
return false;
+ }
return true;
}
-
+
}
Modified: search/trunk/src/test/java/org/hibernate/search/test/engine/BusStop.java
===================================================================
--- search/trunk/src/test/java/org/hibernate/search/test/engine/BusStop.java 2010-01-09 18:45:58 UTC (rev 18488)
+++ search/trunk/src/test/java/org/hibernate/search/test/engine/BusStop.java 2010-01-09 19:47:29 UTC (rev 18489)
@@ -26,7 +26,7 @@
import java.util.HashSet;
import java.util.Set;
-
+import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@@ -37,12 +37,12 @@
/**
* Test entity: BusStop is @ContainedIn BusLine
- *
+ *
* @author Sanne Grinovero
*/
@Entity
public class BusStop {
-
+
private Long id;
private String roadName;
private Set<BusLine> busses = new HashSet<BusLine>();
@@ -66,7 +66,7 @@
this.roadName = roadName;
}
- @ManyToMany(mappedBy="stops")
+ @ManyToMany(mappedBy = "stops", cascade = CascadeType.ALL)
@ContainedIn
public Set<BusLine> getBusses() {
return busses;
@@ -81,25 +81,31 @@
final int prime = 31;
int result = 1;
result = prime * result
- + ((roadName == null) ? 0 : roadName.hashCode());
+ + ( ( roadName == null ) ? 0 : roadName.hashCode() );
return result;
}
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if ( this == obj ) {
return true;
- if (obj == null)
+ }
+ if ( obj == null ) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if ( getClass() != obj.getClass() ) {
return false;
- BusStop other = (BusStop) obj;
- if (roadName == null) {
- if (other.roadName != null)
+ }
+ BusStop other = ( BusStop ) obj;
+ if ( roadName == null ) {
+ if ( other.roadName != null ) {
return false;
- } else if (!roadName.equals(other.roadName))
+ }
+ }
+ else if ( !roadName.equals( other.roadName ) ) {
return false;
+ }
return true;
}
-
+
}
More information about the hibernate-commits
mailing list