HHH-7156 Make Hibernate ORM compile and run tests using JDK 7 (and JDK 6)
This commit is contained in:
parent
3a5bb1f571
commit
b51b2ff4cb
|
@ -39,7 +39,7 @@ dependencies {
|
|||
// common
|
||||
compile gradleApi()
|
||||
compile localGroovy()
|
||||
// compile 'org.apache.ant:ant:1.8.2'
|
||||
compile 'org.apache.ant:ant:1.8.2'
|
||||
// compile 'org.apache.maven:maven-ant-tasks:2.1.0'
|
||||
|
||||
// needed?
|
||||
|
|
|
@ -49,7 +49,7 @@ public class JavaVersion {
|
|||
this.fullVersionString = javaVersionString;
|
||||
family = fullVersionString.startsWith( "1.6" )
|
||||
? Family.JAVA6
|
||||
: Family.JAVA5;
|
||||
: ( fullVersionString.startsWith( "1.7" ) ? Family.JAVA7 : Family.JAVA5);
|
||||
}
|
||||
|
||||
public String getFullVersionString() {
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.io.BufferedReader;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.lang.String;
|
||||
|
||||
import org.apache.tools.ant.taskdefs.condition.Os;
|
||||
import org.apache.tools.ant.util.FileUtils;
|
||||
|
@ -119,35 +120,23 @@ public class Jdk {
|
|||
private JavaVersion determineJdkVersion() {
|
||||
String javaVersionString = extractFromSunJdk();
|
||||
if ( javaVersionString == null ) {
|
||||
throw new RuntimeException( "Could not determine Java version" );
|
||||
javaVersionString = "1.6";//make 1.6 as default
|
||||
}
|
||||
return new JavaVersion( javaVersionString );
|
||||
}
|
||||
|
||||
private String extractFromSunJdk() {
|
||||
String version = null;
|
||||
final String key = "java version \"";
|
||||
|
||||
try {
|
||||
final File javaCommand = getJavaExecutable();
|
||||
Process javaProcess = Runtime.getRuntime().exec( javaCommand.getAbsolutePath() + " -version" );
|
||||
|
||||
try {
|
||||
BufferedReader br = new BufferedReader( new InputStreamReader( javaProcess.getErrorStream() ) );
|
||||
String line;
|
||||
while ( (line = br.readLine()) != null) {
|
||||
if ( version == null && line.startsWith( key ) ) {
|
||||
version = line.substring( key.length(), line.length() - 1 );
|
||||
}
|
||||
version = extractVersion( new BufferedReader( new InputStreamReader( javaProcess.getErrorStream() ) ) );
|
||||
if( version == null || version.equals( "" )){
|
||||
version = extractVersion( new BufferedReader( new InputStreamReader( javaProcess.getInputStream() ) ) );
|
||||
}
|
||||
br.close();
|
||||
|
||||
br = new BufferedReader( new InputStreamReader( javaProcess.getInputStream() ) );
|
||||
while ( (line = br.readLine()) != null) {
|
||||
if ( version == null && line.startsWith( key ) ) {
|
||||
version = line.substring( key.length(), line.length() - 1 );
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
}
|
||||
finally {
|
||||
javaProcess.destroy();
|
||||
|
@ -158,4 +147,17 @@ public class Jdk {
|
|||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
private String extractVersion(BufferedReader br) throws IOException{
|
||||
final String key = "version \"";
|
||||
String line = null;
|
||||
String version = null;
|
||||
while ( (line = br.readLine()) != null) {
|
||||
if ( version == null && line.contains( key ) ) {
|
||||
version = line.substring( line.indexOf( key ) + key.length(), line.length() - 1 );
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,10 @@ import static org.junit.Assert.fail;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class BasicHibernateAnnotationsTest extends BaseCoreFunctionalTestCase {
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
@Test
|
||||
@RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class )
|
||||
public void testEntity() throws Exception {
|
||||
|
|
|
@ -49,6 +49,10 @@ import static org.junit.Assert.assertTrue;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class SubclassTest extends BaseCoreFunctionalTestCase {
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
@Test
|
||||
public void testPolymorphism() throws Exception {
|
||||
Session s = openSession();
|
||||
|
|
|
@ -59,7 +59,10 @@ import static org.junit.Assert.fail;
|
|||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
@Test
|
||||
public void testNativeQueryWithFormulaAttribute() {
|
||||
SQLFunction dateFunction = getDialect().getFunctions().get( "current_date" );
|
||||
|
@ -214,6 +217,7 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
@Test
|
||||
public void testSQLQueryWithManyToOne() {
|
||||
cleanupCache();
|
||||
Night n = new Night();
|
||||
Calendar c = new GregorianCalendar();
|
||||
c.set( 2000, 2, 2 );
|
||||
|
@ -238,9 +242,11 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
|
|||
Statistics stats = sessionFactory().getStatistics();
|
||||
stats.setStatisticsEnabled( true );
|
||||
Query q = s.getNamedQuery( "night&areaCached" );
|
||||
q.setCacheable( true );
|
||||
List result = q.list();
|
||||
assertEquals( 1, result.size() );
|
||||
assertEquals( 1, stats.getQueryCachePutCount() );
|
||||
q.setCacheable( true );
|
||||
q.list();
|
||||
assertEquals( 1, stats.getQueryCacheHitCount() );
|
||||
Night n2 = (Night) ( (Object[]) result.get( 0 ) )[0];
|
||||
|
|
|
@ -57,12 +57,9 @@ public class ExplicitSqlResultSetMappingTest extends BaseCoreFunctionalTestCase
|
|||
s.close();
|
||||
}
|
||||
|
||||
private void cleanupTestData() {
|
||||
Session s = sessionFactory().openSession();
|
||||
s.beginTransaction();
|
||||
s.createQuery( "delete MyEntity" ).executeUpdate();
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -75,8 +72,6 @@ public class ExplicitSqlResultSetMappingTest extends BaseCoreFunctionalTestCase
|
|||
.list();
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
|
||||
cleanupTestData();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -90,7 +85,5 @@ public class ExplicitSqlResultSetMappingTest extends BaseCoreFunctionalTestCase
|
|||
.list();
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
|
||||
cleanupTestData();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,10 @@ public class DeleteTransientEntityTest extends BaseCoreFunctionalTestCase {
|
|||
public String[] getMappings() {
|
||||
return new String[] { "deletetransient/Person.hbm.xml" };
|
||||
}
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransientEntityDeletionNoCascades() {
|
||||
|
|
|
@ -108,7 +108,10 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
|||
private static final Logger log = Logger.getLogger( ASTParserLoadingTest.class );
|
||||
|
||||
private List<Long> createdAnimalIds = new ArrayList<Long>();
|
||||
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] {
|
||||
|
|
|
@ -54,6 +54,11 @@ import static org.junit.Assert.assertTrue;
|
|||
public class FumTest extends LegacyTestCase {
|
||||
private static short fumKeyShort = 1;
|
||||
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] {
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.test.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
|
||||
import org.hibernate.Query;
|
||||
|
@ -66,6 +68,18 @@ public abstract class LegacyTestCase extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void cleanupTestData() throws Exception {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
List list = s.createQuery( "from java.lang.Object" ).list();
|
||||
for ( Object obj : list ) {
|
||||
s.delete( obj );
|
||||
}
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Configuration cfg) {
|
||||
super.configure( cfg );
|
||||
|
|
|
@ -28,6 +28,10 @@ import static org.junit.Assert.assertTrue;
|
|||
|
||||
|
||||
public class MultiTableTest extends LegacyTestCase {
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String[] getMappings() {
|
||||
return new String[] { "legacy/Multi.hbm.xml", "legacy/MultiExtends.hbm.xml" };
|
||||
|
|
|
@ -138,7 +138,6 @@ public class BatchedManyToManyTest extends BaseCoreFunctionalTestCase {
|
|||
s.getTransaction().commit();
|
||||
s.close();
|
||||
|
||||
cleanupTestData();
|
||||
}
|
||||
|
||||
protected void prepareTestData() {
|
||||
|
@ -176,4 +175,9 @@ public class BatchedManyToManyTest extends BaseCoreFunctionalTestCase {
|
|||
s.getTransaction().commit();
|
||||
s.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import static org.junit.Assert.*;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class MergeTest extends AbstractOperationTestCase {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment"})
|
||||
public void testMergeStaleVersionFails() throws Exception {
|
||||
|
@ -62,9 +63,11 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment"})
|
||||
public void testMergeBidiPrimayKeyOneToOne() throws Exception {
|
||||
rebuildSessionFactory();
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().begin();
|
||||
Session s = openSession();
|
||||
Person p = new Person( "steve" );
|
||||
|
||||
new PersonalDetails( "I have big feet", p );
|
||||
s.persist( p );
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
@ -120,6 +123,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@SuppressWarnings( {"UnusedAssignment"})
|
||||
public void testNoExtraUpdatesOnMerge() throws Exception {
|
||||
|
@ -155,7 +159,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
assertInsertCount( 0 );
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -197,7 +201,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
assertInsertCount( 1 );
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -238,7 +242,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
assertInsertCount( 0 );
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -285,7 +289,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
assertInsertCount( 1 );
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -342,7 +346,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
assertInsertCount( 1 );
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
// cleanup();
|
||||
//
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -366,7 +370,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -390,7 +394,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -554,7 +558,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
assertInsertCount( 1 );
|
||||
assertUpdateCount( 2 );
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -591,7 +595,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
assertInsertCount( 1 );
|
||||
assertUpdateCount( 2 );
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -645,7 +649,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -694,7 +698,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
);
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -744,7 +748,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
);
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -768,7 +772,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
s.merge( jboss.getEmployees().iterator().next() );
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -794,7 +798,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
s = applyNonFlushedChangesToNewSessionCloseOldSession( s );
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
||||
cleanup();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -841,11 +845,10 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
s.delete( competition );
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@SuppressWarnings( {"unchecked"})
|
||||
private void cleanup() throws Exception {
|
||||
protected void cleanupTestData() throws Exception {
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().begin();
|
||||
Session s = openSession();
|
||||
s.createQuery( "delete from NumberedNode where parent is not null" ).executeUpdate();
|
||||
|
@ -867,5 +870,10 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
|
||||
TestingJtaBootstrap.INSTANCE.getTransactionManager().commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isCleanupTestDataRequired() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ public class MergeTest extends AbstractOperationTestCase {
|
|||
|
||||
@Test
|
||||
public void testMergeBidiPrimayKeyOneToOne() throws Exception {
|
||||
rebuildSessionFactory();
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
Person p = new Person( "steve" );
|
||||
|
|
|
@ -215,7 +215,7 @@ public class PaginationTest extends BaseCoreFunctionalTestCase {
|
|||
session.close();
|
||||
}
|
||||
|
||||
private void cleanupTestData() {
|
||||
public void cleanupTestData() {
|
||||
Session session = openSession();
|
||||
session.beginTransaction();
|
||||
session.createQuery( "delete DataPoint" ).executeUpdate();
|
||||
|
|
|
@ -19,7 +19,7 @@ public class Baz implements Named, Serializable, Comparable {
|
|||
private int[] intArray;
|
||||
private FooProxy[] fooArray;
|
||||
private String[] stringArray;
|
||||
private String code;
|
||||
private String code="aaa";
|
||||
private List customs;
|
||||
private List topComponents;
|
||||
private Set fooSet;
|
||||
|
|
|
@ -3,6 +3,8 @@ package org.hibernate.ejb.test.connection;
|
|||
import java.io.PrintWriter;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.util.logging.Logger;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
|
@ -40,4 +42,8 @@ public class FakeDataSource implements DataSource {
|
|||
public boolean isWrapperFor(Class<?> aClass) throws SQLException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,24 +70,24 @@ public class EnversRunner extends Suite {
|
|||
fParameterSetNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<FrameworkMethod> doComputation() {
|
||||
List<FrameworkMethod> frameworkMethods = super.doComputation();
|
||||
@Override
|
||||
protected void sortMethods(List<FrameworkMethod> computedTestMethods) {
|
||||
super.sortMethods( computedTestMethods );
|
||||
Collections.sort(computedTestMethods, new Comparator<FrameworkMethod>() {
|
||||
private int getPriority(FrameworkMethod fm) {
|
||||
Priority p = fm.getAnnotation(Priority.class);
|
||||
return p == null ? 0 : p.value();
|
||||
}
|
||||
|
||||
Collections.sort(frameworkMethods, new Comparator<FrameworkMethod>() {
|
||||
private int getPriority(FrameworkMethod fm) {
|
||||
Priority p = fm.getAnnotation(Priority.class);
|
||||
return p == null ? 0 : p.value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(FrameworkMethod fm1, FrameworkMethod fm2) {
|
||||
return getPriority(fm2) - getPriority(fm1);
|
||||
}
|
||||
});
|
||||
|
||||
return frameworkMethods;
|
||||
}
|
||||
@Override
|
||||
public int compare(FrameworkMethod fm1, FrameworkMethod fm2) {
|
||||
return getPriority(fm2) - getPriority(fm1);
|
||||
}
|
||||
});
|
||||
for(FrameworkMethod method: computedTestMethods){
|
||||
System.out.println(method.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final ArrayList<Runner> runners= new ArrayList<Runner>();
|
||||
|
|
|
@ -102,6 +102,9 @@ public class ReadEntityWhitEntityNameTest extends AbstractOneSessionTest{
|
|||
|
||||
@Test
|
||||
public void testObtainEntityNameAuditedEntityWithEntityName() {
|
||||
person1_1 = getAuditReader().find(Person.class, "Personaje", id_pers1, 1);
|
||||
person1_2 = getAuditReader().find(Person.class, "Personaje", id_pers1, 2);
|
||||
person1_3 = getAuditReader().find(Person.class, "Personaje", id_pers1, 3);
|
||||
|
||||
String currentPers1EN = getSession().getEntityName(currentPers1);
|
||||
|
||||
|
|
|
@ -416,11 +416,15 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
|
|||
|
||||
@After
|
||||
public final void afterTest() throws Exception {
|
||||
if ( isCleanupTestDataRequired() ) {
|
||||
cleanupTestData();
|
||||
}
|
||||
cleanupTest();
|
||||
|
||||
cleanupSession();
|
||||
|
||||
assertAllDataRemoved();
|
||||
|
||||
}
|
||||
|
||||
protected void cleanupCache() {
|
||||
|
@ -432,6 +436,14 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
|
|||
sessionFactory.getCache().evictNaturalIdRegions();
|
||||
}
|
||||
}
|
||||
protected boolean isCleanupTestDataRequired(){return false;}
|
||||
protected void cleanupTestData() throws Exception {
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
s.createQuery( "delete from java.lang.Object" ).executeUpdate();
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
}
|
||||
|
||||
|
||||
private void cleanupSession() {
|
||||
|
|
|
@ -25,12 +25,15 @@ package org.hibernate.testing.junit4;
|
|||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
import org.hibernate.testing.DialectCheck;
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
|
@ -142,10 +145,21 @@ public class CustomRunner extends BlockJUnit4ClassRunner {
|
|||
protected List<FrameworkMethod> computeTestMethods() {
|
||||
if ( computedTestMethods == null ) {
|
||||
computedTestMethods = doComputation();
|
||||
sortMethods(computedTestMethods);
|
||||
}
|
||||
return computedTestMethods;
|
||||
}
|
||||
|
||||
protected void sortMethods(List<FrameworkMethod> computedTestMethods) {
|
||||
if( CollectionHelper.isEmpty( computedTestMethods ))return;
|
||||
Collections.sort( computedTestMethods, new Comparator<FrameworkMethod>() {
|
||||
@Override
|
||||
public int compare(FrameworkMethod o1, FrameworkMethod o2) {
|
||||
return o1.getName().compareTo( o2.getName() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
protected List<FrameworkMethod> doComputation() {
|
||||
// Next, get all the test methods as understood by JUnit
|
||||
final List<FrameworkMethod> methods = super.computeTestMethods();
|
||||
|
|
Loading…
Reference in New Issue