HHH-8420 multiple test-only fixes from matrix failures

Conflicts:
	hibernate-core/src/test/java/org/hibernate/loader/EncapsulatedCompositeAttributeResultSetProcessorTest.java
	hibernate-core/src/test/java/org/hibernate/loader/EntityWithNonLazyCollectionResultSetProcessorTest.java
	hibernate-testing/src/main/java/org/hibernate/testing/env/ConnectionProviderBuilder.java
This commit is contained in:
Brett Meyer 2013-08-05 16:52:55 -04:00
parent 2fa9a6cd48
commit 2d85d84acc
10 changed files with 46 additions and 67 deletions

View File

@ -14,7 +14,7 @@ import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@Entity(name="Comment")
@Entity(name="CommentTable") // "Comment" reserved in Oracle
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "DTYPE", discriminatorType= DiscriminatorType.STRING, length = 3)
@DiscriminatorValue(value = "WPT")

View File

@ -80,7 +80,7 @@ public class ProxyInterfaceClassLoaderTest extends BaseCoreFunctionalTestCase {
}
@Entity
@Entity( name = "Person" )
@Proxy(proxyClass = IPerson.class)
static class Person implements IPerson {

View File

@ -19,7 +19,7 @@ public class UserConfEntity implements Serializable{
@Id
@ManyToOne
@JoinColumn(name="user_id")
@JoinColumn(name="user_id", nullable = false)
private UserEntity user;
@Id

View File

@ -16,7 +16,7 @@ import javax.persistence.OrderColumn;
import javax.persistence.Table;
@Entity
@Table(name = "USER")
@Table(name = "USERTABLE")
public class UserEntity implements Serializable{
private static final long serialVersionUID = 1L;

View File

@ -30,7 +30,9 @@ import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.env.ConnectionProviderBuilder;
/**
* SessionFactory has to use the {@link CurrentTenantIdentifierResolver} when
@ -40,6 +42,7 @@ import org.hibernate.testing.TestForIssue;
* @author Steve Ebersole
*/
@TestForIssue(jiraKey = "HHH-7306")
@RequiresDialectFeature( value = ConnectionProviderBuilder.class )
public class CurrentTenantResolverMultiTenancyTest extends SchemaBasedMultiTenancyTest {
private TestCurrentTenantIdentifierResolver currentTenantResolver = new TestCurrentTenantIdentifierResolver();

View File

@ -44,6 +44,7 @@ import org.hibernate.service.jdbc.connections.spi.AbstractMultiTenantConnectionP
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.cache.CachingRegionFactory;
import org.hibernate.testing.env.ConnectionProviderBuilder;
import org.hibernate.testing.junit4.BaseUnitTestCase;
@ -53,6 +54,7 @@ import org.hibernate.tool.hbm2ddl.SchemaExport;
/**
* @author Steve Ebersole
*/
@RequiresDialectFeature( value = ConnectionProviderBuilder.class )
public class SchemaBasedMultiTenancyTest extends BaseUnitTestCase {
private DriverManagerConnectionProviderImpl acmeProvider;
private DriverManagerConnectionProviderImpl jbossProvider;

View File

@ -20,28 +20,38 @@
*/
package org.hibernate.test.schemavalidation;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.Session;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.Oracle9iDialect;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.tool.hbm2ddl.SchemaValidator;
import org.junit.Test;
/**
* Allows the BaseCoreFunctionalTestCase to create the schema using TestEntity. The test method validates against an
* identical entity, but using the synonym name.
*
* @author Brett Meyer
*/
@RequiresDialect( Oracle9iDialect.class )
public class SynonymValidationTest extends BaseUnitTestCase {
public class SynonymValidationTest extends BaseCoreFunctionalTestCase {
// TODO: The QA database matrix does not currently have sufficient permissions to be able to create synonyms.
// Until resolved, disable.
// @Override
// protected Class<?>[] getAnnotatedClasses() {
// return new Class<?>[] { TestEntity.class };
// }
//
@Test
public void testSynonymValidation() {
// Session s = openSession();
@ -49,68 +59,21 @@ public class SynonymValidationTest extends BaseUnitTestCase {
// s.createSQLQuery( "CREATE SYNONYM test_synonym FOR test_entity" ).executeUpdate();
// s.getTransaction().commit();
// s.close();
Configuration cfg = new Configuration();
//
// Configuration cfg = new Configuration();
// cfg.addAnnotatedClass( TestEntityWithSynonym.class );
cfg.addAnnotatedClass( TestEntity.class );
cfg.setProperty( AvailableSettings.ENABLE_SYNONYMS, "true" );
cfg.setProperty( "hibernate.connection.includeSynonyms", "true" );
cfg.getProperties().put( "includeSynonyms", true );
// SchemaValidator schemaValidator = new SchemaValidator( serviceRegistry(), cfg );
SchemaValidator schemaValidator = new SchemaValidator( cfg );
schemaValidator.validate();
// cfg.setProperty( AvailableSettings.ENABLE_SYNONYMS, "true" );
//
// SchemaValidator schemaValidator = new SchemaValidator( cfg );
// schemaValidator.validate();
//
// s = openSession();
// s.getTransaction().begin();
// s.createSQLQuery( "DROP SYNONYM test_synonym FORCE" ).executeUpdate();
// s.getTransaction().commit();
// s.close();
}
// protected Class<?>[] getAnnotatedClasses() {
// return new Class<?>[] { TestEntity.class };
// }
@Entity
@Table(name = "TEST_SYN")
private static class TestEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String key;
private String value;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
//
// @Entity
// @Table(name = "test_entity")
// private static class TestEntity {

View File

@ -27,18 +27,22 @@ import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
import org.junit.Test;
import org.hibernate.Session;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.SkipForDialects;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
/**
* @author Strong Liu <stliu@hibernate.org>
*/
@SkipForDialect(value = H2Dialect.class, comment = "H2 doesn't support this sql syntax")
@SkipForDialects({
@SkipForDialect(value = H2Dialect.class, comment = "H2 doesn't support this sql syntax"),
@SkipForDialect(value = SQLServerDialect.class, comment = "mssql doesn't support multiple columns in the 'where' clause of a 'where in' query")})
@TestForIssue( jiraKey = "HHH-8312")
public class CompositeIdTypeBindingTest extends BaseCoreFunctionalTestCase {
@Override

View File

@ -3,7 +3,8 @@
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false">
<class name="org.hibernate.envers.test.integration.components.dynamic.NotAuditedDynamicMapComponent">
<!-- shortened table name for Oracle -->
<class name="org.hibernate.envers.test.integration.components.dynamic.NotAuditedDynamicMapComponent" table="NotAudited">
<id name="id" type="long" column="id"/>
<property name="note" type="string"/>
<dynamic-component name="customFields">

View File

@ -29,13 +29,14 @@ import org.hibernate.cfg.Environment;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
import org.hibernate.testing.DialectCheck;
/**
* Defines the JDBC connection information (currently H2) used by Hibernate for unit (not functional!) tests
*
* @author Steve Ebersole
*/
public class ConnectionProviderBuilder {
public class ConnectionProviderBuilder implements DialectCheck {
public static final String DRIVER = "org.h2.Driver";
public static final String URL = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;MVCC=TRUE";
public static final String USER = "sa";
@ -79,4 +80,9 @@ public class ConnectionProviderBuilder {
public static Dialect getCorrespondingDialect() {
return new H2Dialect();
}
@Override
public boolean isMatch(Dialect dialect) {
return getCorrespondingDialect().getClass().equals( dialect.getClass() );
}
}