HHH-7919 : Miscellaneous bugfixes
This commit is contained in:
parent
9bb0b2a7f3
commit
1b9ca7df6c
|
@ -23,22 +23,25 @@
|
|||
*/
|
||||
package org.hibernate.test.formulajoin;
|
||||
|
||||
import org.hibernate.cfg.Configuration;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class AnnotatedFormWithBeanValidationNotNullTest extends BaseUnitTestCase {
|
||||
public class AnnotatedFormWithBeanValidationNotNullTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
protected Class<?>[] getAnnotatedClasses() {
|
||||
return new Class[] { AnnotatedMaster.class, AnnotatedDetail.class };
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-8167")
|
||||
public void testAnnotatedFormWithBeanValidationNotNull() {
|
||||
Configuration cfg = new Configuration();
|
||||
cfg.addAnnotatedClass( AnnotatedMaster.class ).addAnnotatedClass( AnnotatedDetail.class );
|
||||
cfg.buildSessionFactory();
|
||||
//doing noting, we here only testing the mapping binding
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@ package org.hibernate.test.instrument.cases;
|
|||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.metamodel.MetadataSources;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.testing.ServiceRegistryBuilder;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -16,13 +18,22 @@ public abstract class AbstractExecutable implements Executable {
|
|||
@Override
|
||||
public final void prepare() {
|
||||
Configuration cfg = new Configuration().setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
|
||||
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( cfg.getProperties() );
|
||||
String[] resources = getResources();
|
||||
if( BaseUnitTestCase.isMetadataUsed()){
|
||||
MetadataSources metadataSources = new MetadataSources( serviceRegistry );
|
||||
for(String resource : resources){
|
||||
metadataSources.addResource( resource );
|
||||
}
|
||||
factory = metadataSources.buildMetadata().buildSessionFactory();
|
||||
}else{
|
||||
for ( String resource : resources ) {
|
||||
cfg.addResource( resource );
|
||||
}
|
||||
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry( cfg.getProperties() );
|
||||
factory = cfg.buildSessionFactory( serviceRegistry );
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public final void complete() {
|
||||
try {
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class BaseUnitTestCase {
|
|||
*/
|
||||
protected static final String OUTPUT_PREFIX = SqlStatementLogger.OUTPUT_PREFIX;
|
||||
protected static boolean isMetadataUsed = Boolean.valueOf( System.getProperty( USE_NEW_METADATA_MAPPINGS, "true" ) );
|
||||
protected static boolean isMetadataUsed() {
|
||||
public static boolean isMetadataUsed() {
|
||||
return isMetadataUsed;
|
||||
}
|
||||
@Rule
|
||||
|
|
Loading…
Reference in New Issue