[hibernate-commits] Hibernate SVN: r19163 - in search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test: jpa and 1 other directory.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Sat Apr 3 16:56:16 EDT 2010
Author: sannegrinovero
Date: 2010-04-03 16:56:15 -0400 (Sat, 03 Apr 2010)
New Revision: 19163
Added:
search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/jpa/JPATestCase.java
Removed:
search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/JPATestCase.java
Log:
moving JPATestCase to correct package
Deleted: search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/JPATestCase.java
===================================================================
--- search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/JPATestCase.java 2010-04-02 17:02:49 UTC (rev 19162)
+++ search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/JPATestCase.java 2010-04-03 20:56:15 UTC (rev 19163)
@@ -1,138 +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.jpa;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Properties;
-import java.util.ArrayList;import java.util.Arrays;
-import java.io.InputStream;
-import java.io.IOException;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-import org.hibernate.cfg.Environment;
-import org.hibernate.ejb.AvailableSettings;
-import org.hibernate.ejb.HibernatePersistence;
-import org.hibernate.search.store.RAMDirectoryProvider;
-import org.hibernate.search.test.SearchTestCase;
-import org.apache.lucene.analysis.StopAnalyzer;
-import org.apache.lucene.util.Version;
-
-/**
- * @author Emmanuel Bernard
- */
-public abstract class JPATestCase extends junit.framework.TestCase {
- protected EntityManagerFactory factory;
-
- public JPATestCase() {
- super();
- }
-
- public JPATestCase(String name) {
- super( name );
- }
-
- public void setUp() {
- factory = new HibernatePersistence().createEntityManagerFactory( getConfig() );
- }
-
- public void tearDown() {
- factory.close();
- }
-
- public abstract Class[] getAnnotatedClasses();
-
- public String[] getEjb3DD() {
- return new String[]{};
- }
-
- public Map<Class, String> getCachedClasses() {
- return new HashMap<Class, String>();
- }
-
- public Map<String, String> getCachedCollections() {
- return new HashMap<String, String>();
- }
-
- public static Properties loadProperties() {
- Properties props = new Properties();
- InputStream stream = Persistence.class.getResourceAsStream( "/hibernate.properties" );
- if ( stream != null ) {
- try {
- props.load( stream );
- }
- catch (Exception e) {
- throw new RuntimeException( "could not load hibernate.properties" );
- }
- finally {
- try {
- stream.close();
- }
- catch (IOException ioe) {
- }
- }
- }
- props.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
- return props;
- }
-
- public Map getConfig() {
- Map config = loadProperties();
- ArrayList<Class> classes = new ArrayList<Class>();
-
- classes.addAll( Arrays.asList( getAnnotatedClasses() ) );
- config.put( AvailableSettings.LOADED_CLASSES, classes );
- for ( Map.Entry<Class, String> entry : getCachedClasses().entrySet() ) {
- config.put(
- AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
- entry.getValue()
- );
- }
- for ( Map.Entry<String, String> entry : getCachedCollections().entrySet() ) {
- config.put(
- AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
- entry.getValue()
- );
- }
- if ( getEjb3DD().length > 0 ) {
- ArrayList<String> dds = new ArrayList<String>();
- dds.addAll( Arrays.asList( getEjb3DD() ) );
- config.put( AvailableSettings.XML_FILE_NAMES, dds );
- }
-
- //Search config
- config.put( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
- config.put( org.hibernate.search.Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
-
- return config;
- }
-
- public static Version getTargetLuceneVersion() {
- return SearchTestCase.getTargetLuceneVersion();
- }
-
-}
-
Copied: search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/jpa/JPATestCase.java (from rev 19156, search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/JPATestCase.java)
===================================================================
--- search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/jpa/JPATestCase.java (rev 0)
+++ search/trunk/hibernate-search-testing/src/main/java/org/hibernate/search/test/jpa/JPATestCase.java 2010-04-03 20:56:15 UTC (rev 19163)
@@ -0,0 +1,138 @@
+/* $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.jpa;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.ArrayList;import java.util.Arrays;
+import java.io.InputStream;
+import java.io.IOException;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import org.hibernate.cfg.Environment;
+import org.hibernate.ejb.AvailableSettings;
+import org.hibernate.ejb.HibernatePersistence;
+import org.hibernate.search.store.RAMDirectoryProvider;
+import org.hibernate.search.test.SearchTestCase;
+import org.apache.lucene.analysis.StopAnalyzer;
+import org.apache.lucene.util.Version;
+
+/**
+ * @author Emmanuel Bernard
+ */
+public abstract class JPATestCase extends junit.framework.TestCase {
+ protected EntityManagerFactory factory;
+
+ public JPATestCase() {
+ super();
+ }
+
+ public JPATestCase(String name) {
+ super( name );
+ }
+
+ public void setUp() {
+ factory = new HibernatePersistence().createEntityManagerFactory( getConfig() );
+ }
+
+ public void tearDown() {
+ factory.close();
+ }
+
+ public abstract Class[] getAnnotatedClasses();
+
+ public String[] getEjb3DD() {
+ return new String[]{};
+ }
+
+ public Map<Class, String> getCachedClasses() {
+ return new HashMap<Class, String>();
+ }
+
+ public Map<String, String> getCachedCollections() {
+ return new HashMap<String, String>();
+ }
+
+ public static Properties loadProperties() {
+ Properties props = new Properties();
+ InputStream stream = Persistence.class.getResourceAsStream( "/hibernate.properties" );
+ if ( stream != null ) {
+ try {
+ props.load( stream );
+ }
+ catch (Exception e) {
+ throw new RuntimeException( "could not load hibernate.properties" );
+ }
+ finally {
+ try {
+ stream.close();
+ }
+ catch (IOException ioe) {
+ }
+ }
+ }
+ props.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
+ return props;
+ }
+
+ public Map getConfig() {
+ Map config = loadProperties();
+ ArrayList<Class> classes = new ArrayList<Class>();
+
+ classes.addAll( Arrays.asList( getAnnotatedClasses() ) );
+ config.put( AvailableSettings.LOADED_CLASSES, classes );
+ for ( Map.Entry<Class, String> entry : getCachedClasses().entrySet() ) {
+ config.put(
+ AvailableSettings.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
+ entry.getValue()
+ );
+ }
+ for ( Map.Entry<String, String> entry : getCachedCollections().entrySet() ) {
+ config.put(
+ AvailableSettings.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
+ entry.getValue()
+ );
+ }
+ if ( getEjb3DD().length > 0 ) {
+ ArrayList<String> dds = new ArrayList<String>();
+ dds.addAll( Arrays.asList( getEjb3DD() ) );
+ config.put( AvailableSettings.XML_FILE_NAMES, dds );
+ }
+
+ //Search config
+ config.put( "hibernate.search.default.directory_provider", RAMDirectoryProvider.class.getName() );
+ config.put( org.hibernate.search.Environment.ANALYZER_CLASS, StopAnalyzer.class.getName() );
+
+ return config;
+ }
+
+ public static Version getTargetLuceneVersion() {
+ return SearchTestCase.getTargetLuceneVersion();
+ }
+
+}
+
More information about the hibernate-commits
mailing list