[hibernate-commits] Hibernate SVN: r20686 - in search/trunk: hibernate-search/src/test/java/org/hibernate/search/test/optimizer and 8 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Sep 23 06:45:24 EDT 2010


Author: hardy.ferentschik
Date: 2010-09-23 06:45:22 -0400 (Thu, 23 Sep 2010)
New Revision: 20686

Added:
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/Construction.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/IncrementalOptimizerStrategyPerfTest.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/OptimizerPerfTest.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/Worker.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/AbstractActivity.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/BufferSharingReaderPerfTest.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/Detective.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/IndexFillRunnable.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/InsertActivity.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/NotSharedReaderPerfTest.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/ReaderPerfTestCase.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/ReaderPerformance.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SearchActivity.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SharedBufferedReaderPerfTest.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SharedReaderPerfTest.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/Suspect.java
   search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/UpdateActivity.java
   search/trunk/hibernate-search-integrationtest/src/test/resources/hibernate.properties
Removed:
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Construction.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/IncrementalOptimizerStrategyPerfTest.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/OptimizerPerfTest.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Worker.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/NotSharedReaderPerfTest.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/ReaderPerfTestCase.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedBufferedReaderPerfTest.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedReaderPerfTest.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/AbstractActivity.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/BufferSharingReaderPerfTest.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/IndexFillRunnable.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/InsertActivity.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/NotSharedReaderPerfTest.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/ReaderPerformance.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SearchActivity.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SharedReaderPerfTest.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/UpdateActivity.java
Modified:
   search/trunk/hibernate-search-integrationtest/pom.xml
   search/trunk/hibernate-search/pom.xml
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Detective.java
   search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Suspect.java
Log:
HSEARCH-592 Moved performance tests into the integration test module

Modified: search/trunk/hibernate-search/pom.xml
===================================================================
--- search/trunk/hibernate-search/pom.xml	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/pom.xml	2010-09-23 10:45:22 UTC (rev 20686)
@@ -125,10 +125,6 @@
                     <forkMode>once</forkMode>
                     <redirectTestOutputToFile>true</redirectTestOutputToFile>
                     <systemProperties>
-                        <property>
-                            <name>build.dir</name>
-                            <value>${basedir}/target</value>
-                        </property>
                         <!--
                                 Following is the default jgroups mcast address. If you find the testsuite runs very slowly,
                                 there may be problems with multicast on the interface JGroups uses by default on
@@ -154,7 +150,6 @@
                     </systemProperties>
                     <excludes>
                         <exclude>**/classloading/*.java</exclude>
-                        <exclude>**/*PerfTest.java</exclude>
                     </excludes>
                 </configuration>
             </plugin>

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Construction.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Construction.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Construction.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,83 +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.optimizer;
-
-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;
-import org.hibernate.search.annotations.Index;
-
-/**
- * @author Emmanuel Bernard
- */
- at Entity
- at Indexed
-public class Construction {
-	@Id
-	@GeneratedValue
-	@DocumentId
-	private Integer id;
-	@Field(index = Index.TOKENIZED)
-	private String name;
-	@Field(index = Index.TOKENIZED)
-	private String address;
-
-
-	public Construction() {
-	}
-
-	public Construction(String name, String address) {
-		this.name = name;
-		this.address = address;
-	}
-
-	public Integer getId() {
-		return id;
-	}
-
-	public void setId(Integer id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getAddress() {
-		return address;
-	}
-
-	public void setAddress(String address) {
-		this.address = address;
-	}
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/IncrementalOptimizerStrategyPerfTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/IncrementalOptimizerStrategyPerfTest.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/IncrementalOptimizerStrategyPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,36 +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.optimizer;
-
-/**
- * @author Emmanuel Bernard
- */
-//having name end in *PerfTest disables it from functional tests
-public class IncrementalOptimizerStrategyPerfTest extends OptimizerPerfTest {
-	protected void configure(org.hibernate.cfg.Configuration cfg) {
-		super.configure( cfg );
-		cfg.setProperty( "hibernate.search.default.optimizer.transaction_limit.max", "10" );
-	}
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/OptimizerPerfTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/OptimizerPerfTest.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/OptimizerPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,215 +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.optimizer;
-
-import java.io.File;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.apache.lucene.analysis.StopAnalyzer;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Query;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.search.Environment;
-import org.hibernate.search.FullTextSession;
-import org.hibernate.search.impl.FullTextSessionImpl;
-import org.hibernate.search.store.FSDirectoryProvider;
-import org.hibernate.search.test.SearchTestCase;
-import org.hibernate.search.util.FileHelper;
-
-/**
- * @author Emmanuel Bernard
- */
-//having name end in *PerfTest disables it from functional tests
-public class OptimizerPerfTest extends SearchTestCase {
-	protected void setUp() throws Exception {
-		File sub = getBaseIndexDir();
-		FileHelper.delete( sub );
-		sub.mkdir();
-		File[] files = sub.listFiles();
-		for ( File file : files ) {
-			if ( file.isDirectory() ) {
-				FileHelper.delete( file );
-			}
-		}
-		super.setUp();
-	}
-
-	protected void tearDown() throws Exception {
-		super.tearDown();
-		File sub = getBaseIndexDir();
-		FileHelper.delete( sub );
-		setCfg( null ); //we need a fresh session factory each time for index set up
-	}
-
-	public void testConcurrency() throws Exception {
-		int nThreads = 15;
-		ExecutorService es = Executors.newFixedThreadPool( nThreads );
-		Work work = new Work( getSessions() );
-		ReverseWork reverseWork = new ReverseWork( getSessions() );
-		long start = System.currentTimeMillis();
-		int iteration = 100;
-		for ( int i = 0; i < iteration; i++ ) {
-			es.execute( work );
-			es.execute( reverseWork );
-		}
-		while ( work.count < iteration - 1 ) {
-			Thread.sleep( 20 );
-		}
-		System.out.println(
-				iteration + " iterations (8 tx per iteration) in " + nThreads + " threads: " + ( System
-						.currentTimeMillis() - start )
-		);
-	}
-
-	protected static class Work implements Runnable {
-		private final SessionFactory sf;
-		public volatile int count = 0;
-
-		public Work(SessionFactory sf) {
-			this.sf = sf;
-		}
-
-		public void run() {
-			try {
-				Session s = sf.openSession();
-				Transaction tx = s.beginTransaction();
-				Worker w = new Worker( "Emmanuel", 65 );
-				s.persist( w );
-				Construction c = new Construction( "Bellagio", "Las Vagas Nevada" );
-				s.persist( c );
-				tx.commit();
-				s.close();
-
-				s = sf.openSession();
-				tx = s.beginTransaction();
-				w = ( Worker ) s.get( Worker.class, w.getId() );
-				w.setName( "Gavin" );
-				c = ( Construction ) s.get( Construction.class, c.getId() );
-				c.setName( "W Hotel" );
-				tx.commit();
-				s.close();
-
-				try {
-					Thread.sleep( 50 );
-				}
-				catch ( InterruptedException e ) {
-					e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-				}
-
-				s = sf.openSession();
-				tx = s.beginTransaction();
-				FullTextSession fts = new FullTextSessionImpl( s );
-				QueryParser parser = new QueryParser( getTargetLuceneVersion(), "id", SearchTestCase.stopAnalyzer );
-				Query query;
-				try {
-					query = parser.parse( "name:Gavin" );
-				}
-				catch ( ParseException e ) {
-					throw new RuntimeException( e );
-				}
-				boolean results = fts.createFullTextQuery( query ).list().size() > 0;
-				//don't test because in case of async, it query happens before actual saving
-				//if ( !results ) throw new RuntimeException( "No results!" );
-				tx.commit();
-				s.close();
-
-				s = sf.openSession();
-				tx = s.beginTransaction();
-				w = ( Worker ) s.get( Worker.class, w.getId() );
-				s.delete( w );
-				c = ( Construction ) s.get( Construction.class, c.getId() );
-				s.delete( c );
-				tx.commit();
-				s.close();
-				count++;
-			}
-			catch ( Throwable t ) {
-				t.printStackTrace();
-			}
-		}
-	}
-
-	protected static class ReverseWork implements Runnable {
-		private SessionFactory sf;
-
-		public ReverseWork(SessionFactory sf) {
-			this.sf = sf;
-		}
-
-		public void run() {
-			try {
-				Session s = sf.openSession();
-				Transaction tx = s.beginTransaction();
-				Worker w = new Worker( "Mladen", 70 );
-				s.persist( w );
-				Construction c = new Construction( "Hover Dam", "Croatia" );
-				s.persist( c );
-				tx.commit();
-				s.close();
-
-				s = sf.openSession();
-				tx = s.beginTransaction();
-				w = ( Worker ) s.get( Worker.class, w.getId() );
-				w.setName( "Remi" );
-				c = ( Construction ) s.get( Construction.class, c.getId() );
-				c.setName( "Palais des festivals" );
-				tx.commit();
-				s.close();
-
-				s = sf.openSession();
-				tx = s.beginTransaction();
-				w = ( Worker ) s.get( Worker.class, w.getId() );
-				s.delete( w );
-				c = ( Construction ) s.get( Construction.class, c.getId() );
-				s.delete( c );
-				tx.commit();
-				s.close();
-			}
-			catch ( Throwable t ) {
-				t.printStackTrace();
-			}
-		}
-	}
-
-	protected void configure(org.hibernate.cfg.Configuration cfg) {
-		super.configure( cfg );
-		File sub = getBaseIndexDir();
-		cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
-		cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
-		cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
-	}
-
-	protected Class<?>[] getAnnotatedClasses() {
-		return new Class[] {
-				Worker.class,
-				Construction.class
-		};
-	}
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Worker.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Worker.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Worker.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,83 +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.optimizer;
-
-import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Entity;
-
-import org.hibernate.search.annotations.Indexed;
-import org.hibernate.search.annotations.DocumentId;
-import org.hibernate.search.annotations.Field;
-import org.hibernate.search.annotations.Index;
-
-/**
- * @author Emmanuel Bernard
- */
- at Entity
- at Indexed
-public class Worker {
-	@Id
-	@GeneratedValue
-	@DocumentId
-	private Integer id;
-	@Field(index = Index.TOKENIZED)
-	private String name;
-	@Field(index = Index.UN_TOKENIZED)
-	private int workhours;
-
-
-	public Worker() {
-	}
-
-	public Worker(String name, int workhours) {
-		this.name = name;
-		this.workhours = workhours;
-	}
-
-	public Integer getId() {
-		return id;
-	}
-
-	public void setId(Integer id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public int getWorkhours() {
-		return workhours;
-	}
-
-	public void setWorkhours(int workhours) {
-		this.workhours = workhours;
-	}
-}

Modified: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Detective.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Detective.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Detective.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,37 +1,36 @@
-/* $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.reader;
 
 import javax.persistence.Entity;
-import javax.persistence.Id;
 import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
 
-import org.hibernate.search.annotations.Indexed;
 import org.hibernate.search.annotations.DocumentId;
 import org.hibernate.search.annotations.Field;
 import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.Indexed;
 
 /**
  * @author Emmanuel Bernard

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/NotSharedReaderPerfTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/NotSharedReaderPerfTest.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/NotSharedReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,38 +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.reader;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.search.Environment;
-
-/**
- * @author Emmanuel Bernard
- */
-public class NotSharedReaderPerfTest extends ReaderPerfTestCase {
-	protected void configure(Configuration cfg) {
-		super.configure( cfg );
-		cfg.setProperty( Environment.READER_STRATEGY, "not-shared" );
-	}
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/ReaderPerfTestCase.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/ReaderPerfTestCase.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/ReaderPerfTestCase.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,290 +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.reader;
-
-import java.io.File;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.lucene.analysis.StopAnalyzer;
-import org.apache.lucene.queryParser.MultiFieldQueryParser;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Query;
-import org.slf4j.Logger;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.search.Environment;
-import org.hibernate.search.FullTextQuery;
-import org.hibernate.search.Search;
-import org.hibernate.search.store.FSDirectoryProvider;
-import org.hibernate.search.test.SearchTestCase;
-import org.hibernate.search.util.FileHelper;
-import org.hibernate.search.util.LoggerFactory;
-
-/**
- * @author Emmanuel Bernard
- */
-public abstract class ReaderPerfTestCase extends SearchTestCase {
-
-	private static final Logger log = LoggerFactory.make();
-
-	protected void setUp() throws Exception {
-		File sub = getBaseIndexDir();
-		sub.mkdir();
-		File[] files = sub.listFiles();
-		for ( File file : files ) {
-			if ( file.isDirectory() ) {
-				FileHelper.delete( file );
-			}
-		}
-		super.setUp();
-	}
-
-	@SuppressWarnings("unchecked")
-	protected Class<?>[] getAnnotatedClasses() {
-		return new Class[] {
-				Detective.class,
-				Suspect.class
-		};
-	}
-
-	protected void tearDown() throws Exception {
-		super.tearDown();
-		if ( getSessions() != null ) {
-			getSessions().close();
-		}
-		File sub = getBaseIndexDir();
-		FileHelper.delete( sub );
-		setCfg( null );  //we need a fresh session factory each time for index set up
-	}
-
-	public boolean insert = true;
-
-	public void testConcurrency() throws Exception {
-		Session s = openSession();
-		Transaction tx = s.beginTransaction();
-		for ( int index = 0; index < 5000; index++ ) {
-			Detective detective = new Detective();
-			detective.setName( "John Doe " + index );
-			detective.setBadge( "123455" + index );
-			detective.setPhysicalDescription( "Blond green eye etc etc" );
-			s.persist( detective );
-			Suspect suspect = new Suspect();
-			suspect.setName( "Jane Doe " + index );
-			suspect.setPhysicalDescription( "brunette, short, 30-ish" );
-			if ( index % 20 == 0 ) {
-				suspect.setSuspectCharge( "thief liar " );
-			}
-			else {
-				suspect.setSuspectCharge(
-						" It's 1875 in London. The police have captured career criminal Montmorency. In the process he has been grievously wounded and it is up to a young surgeon to treat his wounds. During his recovery Montmorency learns of the city's new sewer system and sees in it the perfect underground highway for his thievery.  Washington Post columnist John Kelly recommends this title for middle schoolers, especially to be read aloud."
-				);
-			}
-			s.persist( suspect );
-		}
-		tx.commit();
-		s.close();
-
-		Thread.sleep( 1000 );
-
-		int nThreads = 15;
-		ExecutorService es = Executors.newFixedThreadPool( nThreads );
-		Work work = new Work( getSessions() );
-		ReverseWork reverseWork = new ReverseWork( getSessions() );
-		long start = System.currentTimeMillis();
-		int iteration = 100;
-		log.info( "Starting worker threads." );
-		for ( int i = 0; i < iteration; i++ ) {
-			es.execute( work );
-			es.execute( reverseWork );
-		}
-		while ( work.count.get() < iteration - 1 ) {
-			Thread.sleep( 20 );
-		}
-		log.debug( iteration + " iterations in " + nThreads + " threads: " + ( System.currentTimeMillis() - start ) );
-	}
-
-	protected class Work implements Runnable {
-		private Random random = new Random();
-		private SessionFactory sf;
-//		public volatile int count = 0;
-		public AtomicInteger count = new AtomicInteger( 0 );
-
-		public Work(SessionFactory sf) {
-			this.sf = sf;
-		}
-
-		public void run() {
-			Session s = null;
-			Transaction tx = null;
-			try {
-				s = sf.openSession();
-				tx = s.beginTransaction();
-				QueryParser parser = new MultiFieldQueryParser(
-						getTargetLuceneVersion(),
-						new String[] { "name", "physicalDescription", "suspectCharge" },
-						SearchTestCase.standardAnalyzer
-				);
-				FullTextQuery query = getQuery( "John Doe", parser, s );
-				assertTrue( query.getResultSize() != 0 );
-
-				query = getQuery( "green", parser, s );
-				random.nextInt( query.getResultSize() - 15 );
-				query.setFirstResult( random.nextInt( query.getResultSize() - 15 ) );
-				query.setMaxResults( 10 );
-				query.list();
-				tx.commit();
-				s.close();
-
-				s = sf.openSession();
-				tx = s.beginTransaction();
-
-				query = getQuery( "John Doe", parser, s );
-				assertTrue( query.getResultSize() != 0 );
-
-				query = getQuery( "thief", parser, s );
-				int firstResult = random.nextInt( query.getResultSize() - 15 );
-				query.setFirstResult( firstResult );
-				query.setMaxResults( 10 );
-				List result = query.list();
-				Object object = result.get( 0 );
-				if ( insert && object instanceof Detective ) {
-					Detective detective = ( Detective ) object;
-					detective.setPhysicalDescription(
-							detective.getPhysicalDescription() + " Eye"
-									+ firstResult
-					);
-				}
-				else if ( insert && object instanceof Suspect ) {
-					Suspect suspect = ( Suspect ) object;
-					suspect.setPhysicalDescription(
-							suspect.getPhysicalDescription() + " Eye"
-									+ firstResult
-					);
-				}
-				tx.commit();
-				s.close();
-				// count++;
-			}
-			catch ( Throwable t ) {
-				t.printStackTrace();
-			}
-			finally {
-				count.incrementAndGet();
-				try {
-					if ( tx != null && tx.isActive() ) {
-						tx.rollback();
-					}
-					if ( s != null && s.isOpen() ) {
-						s.close();
-					}
-				}
-				catch ( Throwable t ) {
-					t.printStackTrace();
-				}
-			}
-		}
-
-		private FullTextQuery getQuery(String queryString, QueryParser parser, Session s) {
-			Query luceneQuery = null;
-			try {
-				luceneQuery = parser.parse( queryString );
-			}
-			catch ( ParseException e ) {
-				e.printStackTrace();
-			}
-			return Search.getFullTextSession( s ).createFullTextQuery( luceneQuery );
-		}
-	}
-
-	protected static class ReverseWork implements Runnable {
-		private SessionFactory sf;
-		private Random random = new Random();
-
-		public ReverseWork(SessionFactory sf) {
-			this.sf = sf;
-		}
-
-		public void run() {
-			Session s = sf.openSession();
-			Transaction tx = s.beginTransaction();
-			QueryParser parser = new MultiFieldQueryParser(
-					getTargetLuceneVersion(),
-					new String[] { "name", "physicalDescription", "suspectCharge" },
-					SearchTestCase.standardAnalyzer
-			);
-			FullTextQuery query = getQuery( "John Doe", parser, s );
-			assertTrue( query.getResultSize() != 0 );
-
-			query = getQuery( "london", parser, s );
-			random.nextInt( query.getResultSize() - 15 );
-			query.setFirstResult( random.nextInt( query.getResultSize() - 15 ) );
-			query.setMaxResults( 10 );
-			query.list();
-			tx.commit();
-			s.close();
-
-			s = sf.openSession();
-			tx = s.beginTransaction();
-
-			getQuery( "John Doe", parser, s );
-			assertTrue( query.getResultSize() != 0 );
-
-			query = getQuery( "green", parser, s );
-			random.nextInt( query.getResultSize() - 15 );
-			query.setFirstResult( random.nextInt( query.getResultSize() - 15 ) );
-			query.setMaxResults( 10 );
-			query.list();
-			tx.commit();
-			s.close();
-		}
-
-		private FullTextQuery getQuery(String queryString, QueryParser parser, Session s) {
-			Query luceneQuery = null;
-			try {
-				luceneQuery = parser.parse( queryString );
-			}
-			catch ( ParseException e ) {
-				e.printStackTrace();
-			}
-			return Search.getFullTextSession( s ).createFullTextQuery( luceneQuery );
-		}
-	}
-
-	protected void configure(org.hibernate.cfg.Configuration cfg) {
-		super.configure( cfg );
-		File sub = getBaseIndexDir();
-		cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
-		cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
-		cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
-	}
-
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedBufferedReaderPerfTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedBufferedReaderPerfTest.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedBufferedReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,39 +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.reader;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.search.Environment;
-import org.hibernate.search.reader.SharingBufferReaderProvider;
-
-/**
- * @author Emmanuel Bernard
- */
-public class SharedBufferedReaderPerfTest extends ReaderPerfTestCase {
-	protected void configure(Configuration cfg) {
-		super.configure( cfg );
-		cfg.setProperty( Environment.READER_STRATEGY, SharingBufferReaderProvider.class.getCanonicalName() );
-	}
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedReaderPerfTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedReaderPerfTest.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,40 +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.reader;
-
-import org.hibernate.cfg.Configuration;
-import org.hibernate.search.Environment;
-import org.hibernate.search.reader.SharedReaderProvider;
-
-/**
- * @author Emmanuel Bernard
- */
- at SuppressWarnings("deprecation")
-public class SharedReaderPerfTest extends ReaderPerfTestCase {
-	protected void configure(Configuration cfg) {
-		super.configure( cfg );
-		cfg.setProperty( Environment.READER_STRATEGY, SharedReaderProvider.class.getCanonicalName() );
-	}
-}

Modified: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Suspect.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Suspect.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Suspect.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -24,10 +24,10 @@
  */
 package org.hibernate.search.test.reader;
 
+import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
 
 import org.hibernate.search.annotations.DocumentId;
 import org.hibernate.search.annotations.Field;

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/AbstractActivity.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/AbstractActivity.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/AbstractActivity.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,104 +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.reader.performance;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.lucene.queryParser.MultiFieldQueryParser;
-import org.apache.lucene.queryParser.ParseException;
-import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Query;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.search.FullTextQuery;
-import org.hibernate.search.FullTextSession;
-import org.hibernate.search.Search;
-import org.hibernate.search.test.SearchTestCase;
-
-/**
- * @author Sanne Grinovero
- */
-public abstract class AbstractActivity implements Runnable {
-	
-	private final ThreadLocal<QueryParser> parsers = new ThreadLocal<QueryParser>(){
-		@Override
-		protected QueryParser initialValue(){
-			return new MultiFieldQueryParser( SearchTestCase.getTargetLuceneVersion(),
-					new String[] {"name", "physicalDescription", "suspectCharge"},
-					SearchTestCase.standardAnalyzer );
-			}
-		};
-	
-	private final SessionFactory sf;
-	private final AtomicInteger jobSeed = new AtomicInteger();
-	private final CountDownLatch startSignal;
-	
-	AbstractActivity(SessionFactory sf, CountDownLatch startSignal) {
-		this.startSignal = startSignal;
-		this.sf = sf;
-	}
-	
-	public final void run() {
-		try {
-			startSignal.await();
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-			return;
-		}
-		Session s = sf.openSession();
-		try {
-			FullTextSession fts = Search.getFullTextSession( s );
-			Transaction tx = s.beginTransaction();
-			boolean ok = false;
-			try {
-				doAction( fts, jobSeed.getAndIncrement() );
-				ok = true;
-			} finally {
-				if (ok)
-					tx.commit();
-				else
-					tx.rollback();
-			}
-		} finally {
-			s.close();
-		}
-	}
-	
-	protected FullTextQuery getQuery(String queryString, FullTextSession s, Class... classes) {
-		Query luceneQuery = null;
-		try {
-			luceneQuery = parsers.get().parse(queryString);
-		}
-		catch (ParseException e) {
-			e.printStackTrace();
-		}
-		return s.createFullTextQuery( luceneQuery, classes );
-	}
-
-	protected abstract void doAction(FullTextSession s, int jobSeed);
-
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/BufferSharingReaderPerfTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/BufferSharingReaderPerfTest.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/BufferSharingReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,39 +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.reader.performance;
-
-import org.hibernate.search.reader.SharingBufferReaderProvider;
-
-/**
- * @author Sanne Grinovero
- */
-public class BufferSharingReaderPerfTest extends ReaderPerformance {
-
-	@Override
-	protected String getReaderStrategyName() {
-		return SharingBufferReaderProvider.class.getName();
-	}
-
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/IndexFillRunnable.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/IndexFillRunnable.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/IndexFillRunnable.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,67 +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.reader.performance;
-
-import java.io.IOException;
-
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.lucene.document.Field.Index;
-import org.apache.lucene.document.Field.Store;
-import org.apache.lucene.index.IndexWriter;
-
-/**
- * @author Sanne Grinovero
- */
-public class IndexFillRunnable implements Runnable {
-
-	private volatile int jobSeed = 0;
-	private final IndexWriter iw;
-
-	public IndexFillRunnable(IndexWriter iw) {
-		super();
-		this.iw = iw;
-	}
-
-	public void run() {
-		Field f1 = new Field( "name", "Some One " + jobSeed++, Store.NO, Index.ANALYZED );
-		Field f2 = new Field(
-				"physicalDescription",
-				" just more people sitting around and filling my index... ",
-				Store.NO,
-				Index.ANALYZED
-		);
-		Document d = new Document();
-		d.add( f1 );
-		d.add( f2 );
-		try {
-			iw.addDocument( d );
-		}
-		catch ( IOException e ) {
-			e.printStackTrace();
-		}
-	}
-
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/InsertActivity.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/InsertActivity.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/InsertActivity.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,62 +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.reader.performance;
-
-import java.util.concurrent.CountDownLatch;
-
-import org.hibernate.SessionFactory;
-import org.hibernate.search.FullTextSession;
-import org.hibernate.search.test.reader.Detective;
-import org.hibernate.search.test.reader.Suspect;
-
-/**
- * @author Emmanuel Bernard
- * @author Sanne Grinovero
- */
-public class InsertActivity extends AbstractActivity {
-	
-	InsertActivity(SessionFactory sf, CountDownLatch startSignal) {
-		super(sf, startSignal);
-	}
-
-	@Override
-	protected void doAction(FullTextSession s, int jobSeed) {
-		Detective detective = new Detective();
-		detective.setName("John Doe " + jobSeed);
-		detective.setBadge("123455" + jobSeed);
-		detective.setPhysicalDescription("Blond green eye etc etc");
-		s.persist(detective);
-		Suspect suspect = new Suspect();
-		suspect.setName("Jane Doe " + jobSeed);
-		suspect.setPhysicalDescription("brunette, short, 30-ish");
-		if (jobSeed % 20 == 0) {
-			suspect.setSuspectCharge("thief liar ");
-		} else {
-			suspect.setSuspectCharge(" It's 1875 in London. The police have captured career criminal Montmorency. In the process he has been grievously wounded and it is up to a young surgeon to treat his wounds. During his recovery Montmorency learns of the city's new sewer system and sees in it the perfect underground highway for his thievery.  Washington Post columnist John Kelly recommends this title for middle schoolers, especially to be read aloud.");
-		}
-		s.persist(suspect);
-	}
-
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/NotSharedReaderPerfTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/NotSharedReaderPerfTest.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/NotSharedReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,37 +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.reader.performance;
-
-/**
- * @author Sanne Grinovero
- */
-public class NotSharedReaderPerfTest extends ReaderPerformance {
-
-	@Override
-	protected String getReaderStrategyName() {
-		return "not-shared";
-	}
-
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/ReaderPerformance.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/ReaderPerformance.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/ReaderPerformance.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,150 +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.reader.performance;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.lucene.analysis.SimpleAnalyzer;
-import org.apache.lucene.analysis.StopAnalyzer;
-import org.apache.lucene.index.CorruptIndexException;
-import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.store.FSDirectory;
-import org.apache.lucene.store.LockObtainFailedException;
-import org.hibernate.search.Environment;
-import org.hibernate.search.store.FSDirectoryProvider;
-import org.hibernate.search.test.SearchTestCase;
-import org.hibernate.search.test.reader.Detective;
-import org.hibernate.search.test.reader.Suspect;
-import org.hibernate.search.util.FileHelper;
-
-/**
- * To enable performance tests: de-comment buildBigIndex(); in setUp() and rename no_testPerformance
- * @author Sanne Grinovero
- */
-public abstract class ReaderPerformance extends SearchTestCase {
-		
-	//more iterations for more reliable measures:
-	private static final int TOTAL_WORK_BATCHES = 10;
-	//the next 3 define the kind of workload mix to test on:
-	private static final int SEARCHERS_PER_BATCH = 10;
-	private static final int UPDATES_PER_BATCH = 2;
-	private static final int INSERTIONS_PER_BATCH = 1;
-
-	private static final int WORKER_THREADS = 20;
-
-	private static final int WARMUP_CYCLES = 6;
-	
-	protected void setUp() throws Exception {
-		File baseIndexDir = getBaseIndexDir();
-		baseIndexDir.mkdir();
-		File[] files = baseIndexDir.listFiles();
-		for ( File file : files ) {
-			FileHelper.delete( file );
-		}
-		super.setUp();
-	}
-	
-	private void buildBigIndex() throws InterruptedException, CorruptIndexException, LockObtainFailedException, IOException {
-		System.out.println( "Going to create fake index..." );
-		FSDirectory directory = FSDirectory.open(new File(getBaseIndexDir(), Detective.class.getCanonicalName()));
-		IndexWriter.MaxFieldLength fieldLength = new IndexWriter.MaxFieldLength( IndexWriter.DEFAULT_MAX_FIELD_LENGTH );
-		IndexWriter iw = new IndexWriter( directory, new SimpleAnalyzer(), true, fieldLength );
-		IndexFillRunnable filler = new IndexFillRunnable( iw );
-		ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool( WORKER_THREADS );
-		for (int batch=0; batch<=5000000; batch++){
-			executor.execute( filler );
-		}
-		executor.shutdown();
-		executor.awaitTermination( 600, TimeUnit.SECONDS );
-		iw.commit();
-		iw.optimize();
-		iw.close();
-		System.out.println( "Index created." );
-	}
-
-	@SuppressWarnings("unchecked")
-	protected Class<?>[] getAnnotatedClasses() {
-		return new Class[] {
-				Detective.class,
-				Suspect.class
-		};
-	}
-
-	protected void tearDown() throws Exception {
-		super.tearDown();
-		FileHelper.delete( getBaseIndexDir() );
-	}
-	
-	protected void configure(org.hibernate.cfg.Configuration cfg) {
-		super.configure( cfg );
-		cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
-		cfg.setProperty( "hibernate.search.default.indexBase", getBaseIndexDir().getAbsolutePath() );
-		cfg.setProperty( "hibernate.search.default.optimizer.transaction_limit.max", "10" ); // workaround too many open files
-		cfg.setProperty( "hibernate.search.default." + Environment.EXCLUSIVE_INDEX_USE, "true" );
-		cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
-		cfg.setProperty( Environment.READER_STRATEGY, getReaderStrategyName() );
-	}
-
-	protected abstract String getReaderStrategyName();
-	
-	public final void testPerformance() throws InterruptedException, CorruptIndexException, LockObtainFailedException, IOException {
-		buildBigIndex();
-		for (int i=0; i<WARMUP_CYCLES; i++) {
-			timeMs();
-		}
-	}
-	
-	private final void timeMs() throws InterruptedException {
-		ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool( WORKER_THREADS );
-		CountDownLatch startSignal = new CountDownLatch(1);
-		InsertActivity insertionTask = new InsertActivity( getSessions(), startSignal );
-		SearchActivity searchTask = new SearchActivity( getSessions(), startSignal );
-		UpdateActivity updateTask = new UpdateActivity( getSessions(), startSignal );
-		//we declare needed activities in order, scheduler will "mix":
-		for (int batch=0; batch<=TOTAL_WORK_BATCHES; batch++){
-			for ( int inserters=0; inserters<INSERTIONS_PER_BATCH; inserters++)
-				executor.execute( insertionTask );
-			for ( int searchers=0; searchers<SEARCHERS_PER_BATCH; searchers++)
-				executor.execute( searchTask );
-			for ( int updaters=0; updaters<UPDATES_PER_BATCH; updaters++)
-				executor.execute( updateTask );
-		}
-		executor.shutdown();
-		long startTime = System.currentTimeMillis();
-		startSignal.countDown();//start!
-		executor.awaitTermination( 600, TimeUnit.SECONDS );
-		long endTime = System.currentTimeMillis();
-		System.out.println( "Performance test for " + getReaderStrategyName() + ": " + (endTime - startTime) +"ms. (" + 
-				(TOTAL_WORK_BATCHES*SEARCHERS_PER_BATCH) + " searches, " + 
-				(TOTAL_WORK_BATCHES*INSERTIONS_PER_BATCH) + " insertions, " + 
-				(TOTAL_WORK_BATCHES*UPDATES_PER_BATCH) + " updates)" );
-	}
-	
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SearchActivity.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SearchActivity.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SearchActivity.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,51 +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.reader.performance;
-
-import java.util.concurrent.CountDownLatch;
-
-import org.hibernate.SessionFactory;
-import org.hibernate.search.FullTextQuery;
-import org.hibernate.search.FullTextSession;
-import org.hibernate.search.test.reader.Detective;
-
-/**
- * @author Emmanuel Bernard
- * @author Sanne Grinovero
- */
-public class SearchActivity extends AbstractActivity {
-	
-	SearchActivity(SessionFactory sf, CountDownLatch startSignal) {
-		super(sf, startSignal);
-	}
-
-	@Override
-	protected void doAction(FullTextSession s, int jobSeed) {
-		FullTextQuery q = getQuery( "John Doe", s, Detective.class);
-		q.setMaxResults( 10 );
-		q.getResultSize();
-	}
-	
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SharedReaderPerfTest.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SharedReaderPerfTest.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SharedReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,37 +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.reader.performance;
-
-/**
- * @author Sanne Grinovero
- */
-public class SharedReaderPerfTest extends ReaderPerformance {
-
-	@Override
-	protected String getReaderStrategyName() {
-		return "shared";
-	}
-
-}

Deleted: search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/UpdateActivity.java
===================================================================
--- search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/UpdateActivity.java	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/UpdateActivity.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,54 +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.reader.performance;
-
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-
-import org.hibernate.SessionFactory;
-import org.hibernate.search.FullTextQuery;
-import org.hibernate.search.FullTextSession;
-import org.hibernate.search.test.reader.Detective;
-
-/**
- * @author Sanne Grinovero
- */
-public class UpdateActivity extends AbstractActivity {
-
-	UpdateActivity(SessionFactory sf, CountDownLatch startSignal) {
-		super(sf, startSignal);
-	}
-
-	@Override
-	protected void doAction(FullTextSession s, int jobSeed) {
-		FullTextQuery q = getQuery( "John", s, Detective.class );
-		List list = q.setMaxResults( 1 ).list();
-		for ( Object o : list){
-			Detective detective = (Detective) o;
-			detective.setPhysicalDescription( "old" );
-		}
-	}
-
-}

Modified: search/trunk/hibernate-search-integrationtest/pom.xml
===================================================================
--- search/trunk/hibernate-search-integrationtest/pom.xml	2010-09-23 10:43:19 UTC (rev 20685)
+++ search/trunk/hibernate-search-integrationtest/pom.xml	2010-09-23 10:45:22 UTC (rev 20686)
@@ -1,5 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
@@ -12,16 +14,21 @@
 
     <artifactId>hibernate-search-integrationtest</artifactId>
 
-    <name>Hibernate Search Integration Tests</name>
+    <name>Hibernate Search Integration and Performance Tests</name>
     <description>Hibernate Search integration tests. In particular with Spring Framework and JTA</description>
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <spring-release-version>3.0.2.RELEASE</spring-release-version>
-        <maven.deploy.skip>true</maven.deploy.skip>
     </properties>
 
     <build>
+        <testResources>
+            <testResource>
+                <filtering>true</filtering>
+                <directory>src/test/resources</directory>
+            </testResource>
+        </testResources>
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -31,12 +38,22 @@
                     <skip>true</skip>
                 </configuration>
             </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <forkMode>once</forkMode>
+                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                    <excludes>
+                        <exclude>**/*PerfTest.java</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 
-
     <dependencies>
-
         <!-- JBoss TS -->
         <dependency>
             <groupId>org.jboss.jbossts</groupId>
@@ -52,6 +69,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>hibernate-search-testing</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.hibernate</groupId>
             <artifactId>hibernate-entitymanager</artifactId>
             <scope>test</scope>
@@ -150,7 +173,5 @@
             <version>1.2.139</version>
             <scope>test</scope>
         </dependency>
-
     </dependencies>
-
 </project>
\ No newline at end of file

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/Construction.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Construction.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/Construction.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/Construction.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,83 @@
+/* $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.performance.optimizer;
+
+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;
+import org.hibernate.search.annotations.Index;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at Entity
+ at Indexed
+public class Construction {
+	@Id
+	@GeneratedValue
+	@DocumentId
+	private Integer id;
+	@Field(index = Index.TOKENIZED)
+	private String name;
+	@Field(index = Index.TOKENIZED)
+	private String address;
+
+
+	public Construction() {
+	}
+
+	public Construction(String name, String address) {
+		this.name = name;
+		this.address = address;
+	}
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/IncrementalOptimizerStrategyPerfTest.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/IncrementalOptimizerStrategyPerfTest.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/IncrementalOptimizerStrategyPerfTest.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/IncrementalOptimizerStrategyPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,36 @@
+/* $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.performance.optimizer;
+
+/**
+ * @author Emmanuel Bernard
+ */
+//having name end in *PerfTest disables it from functional tests
+public class IncrementalOptimizerStrategyPerfTest extends OptimizerPerfTest {
+	protected void configure(org.hibernate.cfg.Configuration cfg) {
+		super.configure( cfg );
+		cfg.setProperty( "hibernate.search.default.optimizer.transaction_limit.max", "10" );
+	}
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/OptimizerPerfTest.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/OptimizerPerfTest.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/OptimizerPerfTest.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/OptimizerPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,215 @@
+/* $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.performance.optimizer;
+
+import java.io.File;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.apache.lucene.analysis.StopAnalyzer;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Query;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.search.Environment;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.impl.FullTextSessionImpl;
+import org.hibernate.search.store.FSDirectoryProvider;
+import org.hibernate.search.test.SearchTestCase;
+import org.hibernate.search.util.FileHelper;
+
+/**
+ * @author Emmanuel Bernard
+ */
+//having name end in *PerfTest disables it from functional tests
+public class OptimizerPerfTest extends SearchTestCase {
+	protected void setUp() throws Exception {
+		File sub = getBaseIndexDir();
+		FileHelper.delete( sub );
+		sub.mkdir();
+		File[] files = sub.listFiles();
+		for ( File file : files ) {
+			if ( file.isDirectory() ) {
+				FileHelper.delete( file );
+			}
+		}
+		super.setUp();
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		File sub = getBaseIndexDir();
+		FileHelper.delete( sub );
+		setCfg( null ); //we need a fresh session factory each time for index set up
+	}
+
+	public void testConcurrency() throws Exception {
+		int nThreads = 15;
+		ExecutorService es = Executors.newFixedThreadPool( nThreads );
+		Work work = new Work( getSessions() );
+		ReverseWork reverseWork = new ReverseWork( getSessions() );
+		long start = System.currentTimeMillis();
+		int iteration = 100;
+		for ( int i = 0; i < iteration; i++ ) {
+			es.execute( work );
+			es.execute( reverseWork );
+		}
+		while ( work.count < iteration - 1 ) {
+			Thread.sleep( 20 );
+		}
+		System.out.println(
+				iteration + " iterations (8 tx per iteration) in " + nThreads + " threads: " + ( System
+						.currentTimeMillis() - start )
+		);
+	}
+
+	protected static class Work implements Runnable {
+		private final SessionFactory sf;
+		public volatile int count = 0;
+
+		public Work(SessionFactory sf) {
+			this.sf = sf;
+		}
+
+		public void run() {
+			try {
+				Session s = sf.openSession();
+				Transaction tx = s.beginTransaction();
+				Worker w = new Worker( "Emmanuel", 65 );
+				s.persist( w );
+				Construction c = new Construction( "Bellagio", "Las Vagas Nevada" );
+				s.persist( c );
+				tx.commit();
+				s.close();
+
+				s = sf.openSession();
+				tx = s.beginTransaction();
+				w = ( Worker ) s.get( Worker.class, w.getId() );
+				w.setName( "Gavin" );
+				c = ( Construction ) s.get( Construction.class, c.getId() );
+				c.setName( "W Hotel" );
+				tx.commit();
+				s.close();
+
+				try {
+					Thread.sleep( 50 );
+				}
+				catch ( InterruptedException e ) {
+					e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+				}
+
+				s = sf.openSession();
+				tx = s.beginTransaction();
+				FullTextSession fts = new FullTextSessionImpl( s );
+				QueryParser parser = new QueryParser( getTargetLuceneVersion(), "id", SearchTestCase.stopAnalyzer );
+				Query query;
+				try {
+					query = parser.parse( "name:Gavin" );
+				}
+				catch ( ParseException e ) {
+					throw new RuntimeException( e );
+				}
+				boolean results = fts.createFullTextQuery( query ).list().size() > 0;
+				//don't test because in case of async, it query happens before actual saving
+				//if ( !results ) throw new RuntimeException( "No results!" );
+				tx.commit();
+				s.close();
+
+				s = sf.openSession();
+				tx = s.beginTransaction();
+				w = ( Worker ) s.get( Worker.class, w.getId() );
+				s.delete( w );
+				c = ( Construction ) s.get( Construction.class, c.getId() );
+				s.delete( c );
+				tx.commit();
+				s.close();
+				count++;
+			}
+			catch ( Throwable t ) {
+				t.printStackTrace();
+			}
+		}
+	}
+
+	protected static class ReverseWork implements Runnable {
+		private SessionFactory sf;
+
+		public ReverseWork(SessionFactory sf) {
+			this.sf = sf;
+		}
+
+		public void run() {
+			try {
+				Session s = sf.openSession();
+				Transaction tx = s.beginTransaction();
+				Worker w = new Worker( "Mladen", 70 );
+				s.persist( w );
+				Construction c = new Construction( "Hover Dam", "Croatia" );
+				s.persist( c );
+				tx.commit();
+				s.close();
+
+				s = sf.openSession();
+				tx = s.beginTransaction();
+				w = ( Worker ) s.get( Worker.class, w.getId() );
+				w.setName( "Remi" );
+				c = ( Construction ) s.get( Construction.class, c.getId() );
+				c.setName( "Palais des festivals" );
+				tx.commit();
+				s.close();
+
+				s = sf.openSession();
+				tx = s.beginTransaction();
+				w = ( Worker ) s.get( Worker.class, w.getId() );
+				s.delete( w );
+				c = ( Construction ) s.get( Construction.class, c.getId() );
+				s.delete( c );
+				tx.commit();
+				s.close();
+			}
+			catch ( Throwable t ) {
+				t.printStackTrace();
+			}
+		}
+	}
+
+	protected void configure(org.hibernate.cfg.Configuration cfg) {
+		super.configure( cfg );
+		File sub = getBaseIndexDir();
+		cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
+		cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
+		cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+	}
+
+	protected Class<?>[] getAnnotatedClasses() {
+		return new Class[] {
+				Worker.class,
+				Construction.class
+		};
+	}
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/Worker.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/optimizer/Worker.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/Worker.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/optimizer/Worker.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,83 @@
+/* $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.performance.optimizer;
+
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Entity;
+
+import org.hibernate.search.annotations.Indexed;
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Index;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at Entity
+ at Indexed
+public class Worker {
+	@Id
+	@GeneratedValue
+	@DocumentId
+	private Integer id;
+	@Field(index = Index.TOKENIZED)
+	private String name;
+	@Field(index = Index.UN_TOKENIZED)
+	private int workhours;
+
+
+	public Worker() {
+	}
+
+	public Worker(String name, int workhours) {
+		this.name = name;
+		this.workhours = workhours;
+	}
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public int getWorkhours() {
+		return workhours;
+	}
+
+	public void setWorkhours(int workhours) {
+		this.workhours = workhours;
+	}
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/AbstractActivity.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/AbstractActivity.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/AbstractActivity.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/AbstractActivity.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,104 @@
+/* $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.performance.reader;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.lucene.queryParser.MultiFieldQueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.search.FullTextQuery;
+import org.hibernate.search.FullTextSession;
+import org.hibernate.search.Search;
+import org.hibernate.search.test.SearchTestCase;
+
+/**
+ * @author Sanne Grinovero
+ */
+public abstract class AbstractActivity implements Runnable {
+	
+	private final ThreadLocal<QueryParser> parsers = new ThreadLocal<QueryParser>(){
+		@Override
+		protected QueryParser initialValue(){
+			return new MultiFieldQueryParser( SearchTestCase.getTargetLuceneVersion(),
+					new String[] {"name", "physicalDescription", "suspectCharge"},
+					SearchTestCase.standardAnalyzer );
+			}
+		};
+	
+	private final SessionFactory sf;
+	private final AtomicInteger jobSeed = new AtomicInteger();
+	private final CountDownLatch startSignal;
+	
+	AbstractActivity(SessionFactory sf, CountDownLatch startSignal) {
+		this.startSignal = startSignal;
+		this.sf = sf;
+	}
+	
+	public final void run() {
+		try {
+			startSignal.await();
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+			return;
+		}
+		Session s = sf.openSession();
+		try {
+			FullTextSession fts = Search.getFullTextSession( s );
+			Transaction tx = s.beginTransaction();
+			boolean ok = false;
+			try {
+				doAction( fts, jobSeed.getAndIncrement() );
+				ok = true;
+			} finally {
+				if (ok)
+					tx.commit();
+				else
+					tx.rollback();
+			}
+		} finally {
+			s.close();
+		}
+	}
+	
+	protected FullTextQuery getQuery(String queryString, FullTextSession s, Class... classes) {
+		Query luceneQuery = null;
+		try {
+			luceneQuery = parsers.get().parse(queryString);
+		}
+		catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return s.createFullTextQuery( luceneQuery, classes );
+	}
+
+	protected abstract void doAction(FullTextSession s, int jobSeed);
+
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/BufferSharingReaderPerfTest.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/BufferSharingReaderPerfTest.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/BufferSharingReaderPerfTest.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/BufferSharingReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,39 @@
+/* $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.performance.reader;
+
+import org.hibernate.search.reader.SharingBufferReaderProvider;
+
+/**
+ * @author Sanne Grinovero
+ */
+public class BufferSharingReaderPerfTest extends ReaderPerformance {
+
+	@Override
+	protected String getReaderStrategyName() {
+		return SharingBufferReaderProvider.class.getName();
+	}
+
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/Detective.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Detective.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/Detective.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/Detective.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,85 @@
+/* $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.performance.reader;
+
+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;
+import org.hibernate.search.annotations.Index;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at Entity
+ at Indexed
+public class Detective {
+	@Id
+	@GeneratedValue
+	@DocumentId
+	private Integer id;
+	@Field(index = Index.TOKENIZED)
+	private String name;
+	@Field(index = Index.TOKENIZED)
+	private String physicalDescription;
+	@Field(index = Index.UN_TOKENIZED)
+	private String badge;
+
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getPhysicalDescription() {
+		return physicalDescription;
+	}
+
+	public void setPhysicalDescription(String physicalDescription) {
+		this.physicalDescription = physicalDescription;
+	}
+
+	public String getBadge() {
+		return badge;
+	}
+
+	public void setBadge(String badge) {
+		this.badge = badge;
+	}
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/IndexFillRunnable.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/IndexFillRunnable.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/IndexFillRunnable.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/IndexFillRunnable.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,67 @@
+/* $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.performance.reader;
+
+import java.io.IOException;
+
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.Field.Index;
+import org.apache.lucene.document.Field.Store;
+import org.apache.lucene.index.IndexWriter;
+
+/**
+ * @author Sanne Grinovero
+ */
+public class IndexFillRunnable implements Runnable {
+
+	private volatile int jobSeed = 0;
+	private final IndexWriter iw;
+
+	public IndexFillRunnable(IndexWriter iw) {
+		super();
+		this.iw = iw;
+	}
+
+	public void run() {
+		Field f1 = new Field( "name", "Some One " + jobSeed++, Store.NO, Index.ANALYZED );
+		Field f2 = new Field(
+				"physicalDescription",
+				" just more people sitting around and filling my index... ",
+				Store.NO,
+				Index.ANALYZED
+		);
+		Document d = new Document();
+		d.add( f1 );
+		d.add( f2 );
+		try {
+			iw.addDocument( d );
+		}
+		catch ( IOException e ) {
+			e.printStackTrace();
+		}
+	}
+
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/InsertActivity.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/InsertActivity.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/InsertActivity.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/InsertActivity.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,60 @@
+/* $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.performance.reader;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.search.FullTextSession;
+
+/**
+ * @author Emmanuel Bernard
+ * @author Sanne Grinovero
+ */
+public class InsertActivity extends AbstractActivity {
+	
+	InsertActivity(SessionFactory sf, CountDownLatch startSignal) {
+		super(sf, startSignal);
+	}
+
+	@Override
+	protected void doAction(FullTextSession s, int jobSeed) {
+		Detective detective = new Detective();
+		detective.setName("John Doe " + jobSeed);
+		detective.setBadge("123455" + jobSeed);
+		detective.setPhysicalDescription("Blond green eye etc etc");
+		s.persist(detective);
+		Suspect suspect = new Suspect();
+		suspect.setName("Jane Doe " + jobSeed);
+		suspect.setPhysicalDescription("brunette, short, 30-ish");
+		if (jobSeed % 20 == 0) {
+			suspect.setSuspectCharge("thief liar ");
+		} else {
+			suspect.setSuspectCharge(" It's 1875 in London. The police have captured career criminal Montmorency. In the process he has been grievously wounded and it is up to a young surgeon to treat his wounds. During his recovery Montmorency learns of the city's new sewer system and sees in it the perfect underground highway for his thievery.  Washington Post columnist John Kelly recommends this title for middle schoolers, especially to be read aloud.");
+		}
+		s.persist(suspect);
+	}
+
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/NotSharedReaderPerfTest.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/NotSharedReaderPerfTest.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/NotSharedReaderPerfTest.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/NotSharedReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,47 @@
+/* $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.performance.reader;
+
+/**
+ * @author Sanne Grinovero
+ */
+public class NotSharedReaderPerfTest extends ReaderPerformance {
+
+	@Override
+	protected String getReaderStrategyName() {
+		return "not-shared";
+	}
+
+}
+
+///**
+// * @author Emmanuel Bernard
+// */
+//public class NotSharedReaderPerfTest extends ReaderPerfTestCase {
+//	protected void configure(Configuration cfg) {
+//		super.configure( cfg );
+//		cfg.setProperty( Environment.READER_STRATEGY, "not-shared" );
+//	}
+//}
\ No newline at end of file

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/ReaderPerfTestCase.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/ReaderPerfTestCase.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/ReaderPerfTestCase.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/ReaderPerfTestCase.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,290 @@
+/* $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.performance.reader;
+
+import java.io.File;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.lucene.analysis.StopAnalyzer;
+import org.apache.lucene.queryParser.MultiFieldQueryParser;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
+import org.apache.lucene.search.Query;
+import org.slf4j.Logger;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+import org.hibernate.search.Environment;
+import org.hibernate.search.FullTextQuery;
+import org.hibernate.search.Search;
+import org.hibernate.search.store.FSDirectoryProvider;
+import org.hibernate.search.test.SearchTestCase;
+import org.hibernate.search.util.FileHelper;
+import org.hibernate.search.util.LoggerFactory;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public abstract class ReaderPerfTestCase extends SearchTestCase {
+
+	private static final Logger log = LoggerFactory.make();
+
+	protected void setUp() throws Exception {
+		File sub = getBaseIndexDir();
+		sub.mkdir();
+		File[] files = sub.listFiles();
+		for ( File file : files ) {
+			if ( file.isDirectory() ) {
+				FileHelper.delete( file );
+			}
+		}
+		super.setUp();
+	}
+
+	@SuppressWarnings("unchecked")
+	protected Class<?>[] getAnnotatedClasses() {
+		return new Class[] {
+				Detective.class,
+				Suspect.class
+		};
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		if ( getSessions() != null ) {
+			getSessions().close();
+		}
+		File sub = getBaseIndexDir();
+		FileHelper.delete( sub );
+		setCfg( null );  //we need a fresh session factory each time for index set up
+	}
+
+	public boolean insert = true;
+
+	public void testConcurrency() throws Exception {
+		Session s = openSession();
+		Transaction tx = s.beginTransaction();
+		for ( int index = 0; index < 5000; index++ ) {
+			Detective detective = new Detective();
+			detective.setName( "John Doe " + index );
+			detective.setBadge( "123455" + index );
+			detective.setPhysicalDescription( "Blond green eye etc etc" );
+			s.persist( detective );
+			Suspect suspect = new Suspect();
+			suspect.setName( "Jane Doe " + index );
+			suspect.setPhysicalDescription( "brunette, short, 30-ish" );
+			if ( index % 20 == 0 ) {
+				suspect.setSuspectCharge( "thief liar " );
+			}
+			else {
+				suspect.setSuspectCharge(
+						" It's 1875 in London. The police have captured career criminal Montmorency. In the process he has been grievously wounded and it is up to a young surgeon to treat his wounds. During his recovery Montmorency learns of the city's new sewer system and sees in it the perfect underground highway for his thievery.  Washington Post columnist John Kelly recommends this title for middle schoolers, especially to be read aloud."
+				);
+			}
+			s.persist( suspect );
+		}
+		tx.commit();
+		s.close();
+
+		Thread.sleep( 1000 );
+
+		int nThreads = 15;
+		ExecutorService es = Executors.newFixedThreadPool( nThreads );
+		Work work = new Work( getSessions() );
+		ReverseWork reverseWork = new ReverseWork( getSessions() );
+		long start = System.currentTimeMillis();
+		int iteration = 100;
+		log.info( "Starting worker threads." );
+		for ( int i = 0; i < iteration; i++ ) {
+			es.execute( work );
+			es.execute( reverseWork );
+		}
+		while ( work.count.get() < iteration - 1 ) {
+			Thread.sleep( 20 );
+		}
+		log.debug( iteration + " iterations in " + nThreads + " threads: " + ( System.currentTimeMillis() - start ) );
+	}
+
+	protected class Work implements Runnable {
+		private Random random = new Random();
+		private SessionFactory sf;
+//		public volatile int count = 0;
+		public AtomicInteger count = new AtomicInteger( 0 );
+
+		public Work(SessionFactory sf) {
+			this.sf = sf;
+		}
+
+		public void run() {
+			Session s = null;
+			Transaction tx = null;
+			try {
+				s = sf.openSession();
+				tx = s.beginTransaction();
+				QueryParser parser = new MultiFieldQueryParser(
+						getTargetLuceneVersion(),
+						new String[] { "name", "physicalDescription", "suspectCharge" },
+						SearchTestCase.standardAnalyzer
+				);
+				FullTextQuery query = getQuery( "John Doe", parser, s );
+				assertTrue( query.getResultSize() != 0 );
+
+				query = getQuery( "green", parser, s );
+				random.nextInt( query.getResultSize() - 15 );
+				query.setFirstResult( random.nextInt( query.getResultSize() - 15 ) );
+				query.setMaxResults( 10 );
+				query.list();
+				tx.commit();
+				s.close();
+
+				s = sf.openSession();
+				tx = s.beginTransaction();
+
+				query = getQuery( "John Doe", parser, s );
+				assertTrue( query.getResultSize() != 0 );
+
+				query = getQuery( "thief", parser, s );
+				int firstResult = random.nextInt( query.getResultSize() - 15 );
+				query.setFirstResult( firstResult );
+				query.setMaxResults( 10 );
+				List result = query.list();
+				Object object = result.get( 0 );
+				if ( insert && object instanceof Detective ) {
+					Detective detective = ( Detective ) object;
+					detective.setPhysicalDescription(
+							detective.getPhysicalDescription() + " Eye"
+									+ firstResult
+					);
+				}
+				else if ( insert && object instanceof Suspect ) {
+					Suspect suspect = ( Suspect ) object;
+					suspect.setPhysicalDescription(
+							suspect.getPhysicalDescription() + " Eye"
+									+ firstResult
+					);
+				}
+				tx.commit();
+				s.close();
+				// count++;
+			}
+			catch ( Throwable t ) {
+				t.printStackTrace();
+			}
+			finally {
+				count.incrementAndGet();
+				try {
+					if ( tx != null && tx.isActive() ) {
+						tx.rollback();
+					}
+					if ( s != null && s.isOpen() ) {
+						s.close();
+					}
+				}
+				catch ( Throwable t ) {
+					t.printStackTrace();
+				}
+			}
+		}
+
+		private FullTextQuery getQuery(String queryString, QueryParser parser, Session s) {
+			Query luceneQuery = null;
+			try {
+				luceneQuery = parser.parse( queryString );
+			}
+			catch ( ParseException e ) {
+				e.printStackTrace();
+			}
+			return Search.getFullTextSession( s ).createFullTextQuery( luceneQuery );
+		}
+	}
+
+	protected static class ReverseWork implements Runnable {
+		private SessionFactory sf;
+		private Random random = new Random();
+
+		public ReverseWork(SessionFactory sf) {
+			this.sf = sf;
+		}
+
+		public void run() {
+			Session s = sf.openSession();
+			Transaction tx = s.beginTransaction();
+			QueryParser parser = new MultiFieldQueryParser(
+					getTargetLuceneVersion(),
+					new String[] { "name", "physicalDescription", "suspectCharge" },
+					SearchTestCase.standardAnalyzer
+			);
+			FullTextQuery query = getQuery( "John Doe", parser, s );
+			assertTrue( query.getResultSize() != 0 );
+
+			query = getQuery( "london", parser, s );
+			random.nextInt( query.getResultSize() - 15 );
+			query.setFirstResult( random.nextInt( query.getResultSize() - 15 ) );
+			query.setMaxResults( 10 );
+			query.list();
+			tx.commit();
+			s.close();
+
+			s = sf.openSession();
+			tx = s.beginTransaction();
+
+			getQuery( "John Doe", parser, s );
+			assertTrue( query.getResultSize() != 0 );
+
+			query = getQuery( "green", parser, s );
+			random.nextInt( query.getResultSize() - 15 );
+			query.setFirstResult( random.nextInt( query.getResultSize() - 15 ) );
+			query.setMaxResults( 10 );
+			query.list();
+			tx.commit();
+			s.close();
+		}
+
+		private FullTextQuery getQuery(String queryString, QueryParser parser, Session s) {
+			Query luceneQuery = null;
+			try {
+				luceneQuery = parser.parse( queryString );
+			}
+			catch ( ParseException e ) {
+				e.printStackTrace();
+			}
+			return Search.getFullTextSession( s ).createFullTextQuery( luceneQuery );
+		}
+	}
+
+	protected void configure(org.hibernate.cfg.Configuration cfg) {
+		super.configure( cfg );
+		File sub = getBaseIndexDir();
+		cfg.setProperty( "hibernate.search.default.indexBase", sub.getAbsolutePath() );
+		cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
+		cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+	}
+
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/ReaderPerformance.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/ReaderPerformance.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/ReaderPerformance.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/ReaderPerformance.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,148 @@
+/* $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.performance.reader;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.lucene.analysis.SimpleAnalyzer;
+import org.apache.lucene.analysis.StopAnalyzer;
+import org.apache.lucene.index.CorruptIndexException;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.store.FSDirectory;
+import org.apache.lucene.store.LockObtainFailedException;
+import org.hibernate.search.Environment;
+import org.hibernate.search.store.FSDirectoryProvider;
+import org.hibernate.search.test.SearchTestCase;
+import org.hibernate.search.util.FileHelper;
+
+/**
+ * To enable performance tests: de-comment buildBigIndex(); in setUp() and rename no_testPerformance
+ * @author Sanne Grinovero
+ */
+public abstract class ReaderPerformance extends SearchTestCase {
+		
+	//more iterations for more reliable measures:
+	private static final int TOTAL_WORK_BATCHES = 10;
+	//the next 3 define the kind of workload mix to test on:
+	private static final int SEARCHERS_PER_BATCH = 10;
+	private static final int UPDATES_PER_BATCH = 2;
+	private static final int INSERTIONS_PER_BATCH = 1;
+
+	private static final int WORKER_THREADS = 20;
+
+	private static final int WARMUP_CYCLES = 6;
+	
+	protected void setUp() throws Exception {
+		File baseIndexDir = getBaseIndexDir();
+		baseIndexDir.mkdir();
+		File[] files = baseIndexDir.listFiles();
+		for ( File file : files ) {
+			FileHelper.delete( file );
+		}
+		super.setUp();
+	}
+	
+	private void buildBigIndex() throws InterruptedException, CorruptIndexException, LockObtainFailedException, IOException {
+		System.out.println( "Going to create fake index..." );
+		FSDirectory directory = FSDirectory.open(new File(getBaseIndexDir(), Detective.class.getCanonicalName()));
+		IndexWriter.MaxFieldLength fieldLength = new IndexWriter.MaxFieldLength( IndexWriter.DEFAULT_MAX_FIELD_LENGTH );
+		IndexWriter iw = new IndexWriter( directory, new SimpleAnalyzer(), true, fieldLength );
+		IndexFillRunnable filler = new IndexFillRunnable( iw );
+		ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool( WORKER_THREADS );
+		for (int batch=0; batch<=5000000; batch++){
+			executor.execute( filler );
+		}
+		executor.shutdown();
+		executor.awaitTermination( 600, TimeUnit.SECONDS );
+		iw.commit();
+		iw.optimize();
+		iw.close();
+		System.out.println( "Index created." );
+	}
+
+	@SuppressWarnings("unchecked")
+	protected Class<?>[] getAnnotatedClasses() {
+		return new Class[] {
+				Detective.class,
+				Suspect.class
+		};
+	}
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		FileHelper.delete( getBaseIndexDir() );
+	}
+	
+	protected void configure(org.hibernate.cfg.Configuration cfg) {
+		super.configure( cfg );
+		cfg.setProperty( "hibernate.search.default.directory_provider", FSDirectoryProvider.class.getName() );
+		cfg.setProperty( "hibernate.search.default.indexBase", getBaseIndexDir().getAbsolutePath() );
+		cfg.setProperty( "hibernate.search.default.optimizer.transaction_limit.max", "10" ); // workaround too many open files
+		cfg.setProperty( "hibernate.search.default." + Environment.EXCLUSIVE_INDEX_USE, "true" );
+		cfg.setProperty( Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+		cfg.setProperty( Environment.READER_STRATEGY, getReaderStrategyName() );
+	}
+
+	protected abstract String getReaderStrategyName();
+	
+	public final void testPerformance() throws InterruptedException, CorruptIndexException, LockObtainFailedException, IOException {
+		buildBigIndex();
+		for (int i=0; i<WARMUP_CYCLES; i++) {
+			timeMs();
+		}
+	}
+	
+	private final void timeMs() throws InterruptedException {
+		ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool( WORKER_THREADS );
+		CountDownLatch startSignal = new CountDownLatch(1);
+		InsertActivity insertionTask = new InsertActivity( getSessions(), startSignal );
+		SearchActivity searchTask = new SearchActivity( getSessions(), startSignal );
+		UpdateActivity updateTask = new UpdateActivity( getSessions(), startSignal );
+		//we declare needed activities in order, scheduler will "mix":
+		for (int batch=0; batch<=TOTAL_WORK_BATCHES; batch++){
+			for ( int inserters=0; inserters<INSERTIONS_PER_BATCH; inserters++)
+				executor.execute( insertionTask );
+			for ( int searchers=0; searchers<SEARCHERS_PER_BATCH; searchers++)
+				executor.execute( searchTask );
+			for ( int updaters=0; updaters<UPDATES_PER_BATCH; updaters++)
+				executor.execute( updateTask );
+		}
+		executor.shutdown();
+		long startTime = System.currentTimeMillis();
+		startSignal.countDown();//start!
+		executor.awaitTermination( 600, TimeUnit.SECONDS );
+		long endTime = System.currentTimeMillis();
+		System.out.println( "Performance test for " + getReaderStrategyName() + ": " + (endTime - startTime) +"ms. (" + 
+				(TOTAL_WORK_BATCHES*SEARCHERS_PER_BATCH) + " searches, " + 
+				(TOTAL_WORK_BATCHES*INSERTIONS_PER_BATCH) + " insertions, " + 
+				(TOTAL_WORK_BATCHES*UPDATES_PER_BATCH) + " updates)" );
+	}
+	
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SearchActivity.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SearchActivity.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SearchActivity.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SearchActivity.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,50 @@
+/* $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.performance.reader;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.search.FullTextQuery;
+import org.hibernate.search.FullTextSession;
+
+/**
+ * @author Emmanuel Bernard
+ * @author Sanne Grinovero
+ */
+public class SearchActivity extends AbstractActivity {
+	
+	SearchActivity(SessionFactory sf, CountDownLatch startSignal) {
+		super(sf, startSignal);
+	}
+
+	@Override
+	protected void doAction(FullTextSession s, int jobSeed) {
+		FullTextQuery q = getQuery( "John Doe", s, Detective.class);
+		q.setMaxResults( 10 );
+		q.getResultSize();
+	}
+	
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SharedBufferedReaderPerfTest.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/SharedBufferedReaderPerfTest.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SharedBufferedReaderPerfTest.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SharedBufferedReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,39 @@
+/* $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.performance.reader;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.search.Environment;
+import org.hibernate.search.reader.SharingBufferReaderProvider;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public class SharedBufferedReaderPerfTest extends ReaderPerfTestCase {
+	protected void configure(Configuration cfg) {
+		super.configure( cfg );
+		cfg.setProperty( Environment.READER_STRATEGY, SharingBufferReaderProvider.class.getCanonicalName() );
+	}
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SharedReaderPerfTest.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/SharedReaderPerfTest.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SharedReaderPerfTest.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/SharedReaderPerfTest.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,48 @@
+/* $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.performance.reader;
+
+/**
+ * @author Sanne Grinovero
+ */
+public class SharedReaderPerfTest extends ReaderPerformance {
+
+	@Override
+	protected String getReaderStrategyName() {
+		return "shared";
+	}
+
+}
+
+///**
+// * @author Emmanuel Bernard
+// */
+//@SuppressWarnings("deprecation")
+//public class SharedReaderPerfTest extends ReaderPerfTestCase {
+//	protected void configure(Configuration cfg) {
+//		super.configure( cfg );
+//		cfg.setProperty( Environment.READER_STRATEGY, SharedReaderProvider.class.getCanonicalName() );
+//	}
+//}
\ No newline at end of file

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/Suspect.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/Suspect.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/Suspect.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/Suspect.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,87 @@
+/* $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.performance.reader;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+
+import org.hibernate.search.annotations.DocumentId;
+import org.hibernate.search.annotations.Field;
+import org.hibernate.search.annotations.Index;
+import org.hibernate.search.annotations.Indexed;
+
+/**
+ * @author Emmanuel Bernard
+ */
+ at Entity
+ at Indexed
+public class Suspect {
+	@Id
+	@GeneratedValue
+	@DocumentId
+	private Integer id;
+	@Field(index = Index.TOKENIZED)
+	private String name;
+	@Field(index = Index.TOKENIZED)
+	private String physicalDescription;
+	@Field(index = Index.TOKENIZED)
+	@Column(length = 500)
+	private String suspectCharge;
+
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getPhysicalDescription() {
+		return physicalDescription;
+	}
+
+	public void setPhysicalDescription(String physicalDescription) {
+		this.physicalDescription = physicalDescription;
+	}
+
+	public String getSuspectCharge() {
+		return suspectCharge;
+	}
+
+	public void setSuspectCharge(String suspectCharge) {
+		this.suspectCharge = suspectCharge;
+	}
+}

Copied: search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/UpdateActivity.java (from rev 20685, search/trunk/hibernate-search/src/test/java/org/hibernate/search/test/reader/performance/UpdateActivity.java)
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/UpdateActivity.java	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/java/org/hibernate/search/test/performance/reader/UpdateActivity.java	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,53 @@
+/* $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.performance.reader;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.search.FullTextQuery;
+import org.hibernate.search.FullTextSession;
+
+/**
+ * @author Sanne Grinovero
+ */
+public class UpdateActivity extends AbstractActivity {
+
+	UpdateActivity(SessionFactory sf, CountDownLatch startSignal) {
+		super(sf, startSignal);
+	}
+
+	@Override
+	protected void doAction(FullTextSession s, int jobSeed) {
+		FullTextQuery q = getQuery( "John", s, Detective.class );
+		List list = q.setMaxResults( 1 ).list();
+		for ( Object o : list){
+			Detective detective = (Detective) o;
+			detective.setPhysicalDescription( "old" );
+		}
+	}
+
+}

Added: search/trunk/hibernate-search-integrationtest/src/test/resources/hibernate.properties
===================================================================
--- search/trunk/hibernate-search-integrationtest/src/test/resources/hibernate.properties	                        (rev 0)
+++ search/trunk/hibernate-search-integrationtest/src/test/resources/hibernate.properties	2010-09-23 10:45:22 UTC (rev 20686)
@@ -0,0 +1,39 @@
+#
+# Hibernate, Relational Persistence for Idiomatic Java
+#
+#  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
+#
+hibernate.dialect org.hibernate.dialect.HSQLDialect
+hibernate.connection.driver_class org.hsqldb.jdbcDriver
+hibernate.connection.url jdbc:hsqldb:.
+hibernate.connection.username sa
+hibernate.connection.password
+hibernate.connection.isolation
+
+hibernate.connection.pool_size 5
+
+hibernate.show_sql true
+hibernate.format_sql true
+
+hibernate.max_fetch_depth 5
+
+hibernate.cache.region_prefix hibernate.test
+hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider



More information about the hibernate-commits mailing list