-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-8558 - Bytecode enhancer: testsuite reorganization with added laz…
…y loading tests
- Loading branch information
Showing
36 changed files
with
1,653 additions
and
1,567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...-core/src/test/java/org/hibernate/test/bytecode/enhancement/AbstractEnhancerTestTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
/* | |||
* Hibernate, Relational Persistence for Idiomatic Java | |||
* | |||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | |||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | |||
*/ | |||
package org.hibernate.test.bytecode.enhancement; | |||
|
|||
import org.hibernate.SessionFactory; | |||
import org.hibernate.cfg.Configuration; | |||
import org.hibernate.cfg.Environment; | |||
import org.hibernate.service.ServiceRegistry; | |||
|
|||
import org.hibernate.testing.ServiceRegistryBuilder; | |||
|
|||
/** | |||
* @author Luis Barreiro | |||
*/ | |||
public abstract class AbstractEnhancerTestTask implements EnhancerTestTask { | |||
|
|||
private ServiceRegistry serviceRegistry; | |||
private SessionFactory factory; | |||
|
|||
public final void prepare(Configuration user) { | |||
Configuration cfg = new Configuration(); | |||
cfg.setProperties( user.getProperties() ); | |||
cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" ); | |||
|
|||
Class<?>[] resources = getAnnotatedClasses(); | |||
for ( Class<?> resource : resources ) { | |||
cfg.addAnnotatedClass( resource ); | |||
} | |||
|
|||
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( cfg.getProperties() ); | |||
factory = cfg.buildSessionFactory( serviceRegistry ); | |||
} | |||
|
|||
public final void complete() { | |||
try { | |||
cleanup(); | |||
} | |||
finally { | |||
factory.close(); | |||
factory = null; | |||
if ( serviceRegistry != null ) { | |||
ServiceRegistryBuilder.destroy( serviceRegistry ); | |||
serviceRegistry = null; | |||
} | |||
} | |||
} | |||
|
|||
protected SessionFactory getFactory() { | |||
return factory; | |||
} | |||
|
|||
protected abstract void cleanup(); | |||
|
|||
} |
198 changes: 0 additions & 198 deletions
198
...nate-core/src/test/java/org/hibernate/test/bytecode/enhancement/CustomerEnhancerTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.