HHH-8420 multiple test-only fixes from matrix failures
This commit is contained in:
parent
3d595febc5
commit
b9d3fa5581
|
@ -33,6 +33,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.persistence.CollectionTable;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
|
@ -281,6 +283,7 @@ public class EncapsulatedCompositeAttributeResultSetProcessorTest extends BaseCo
|
||||||
}
|
}
|
||||||
|
|
||||||
@ElementCollection(fetch = FetchType.EAGER)
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable( name = "Investments" )
|
||||||
public List<Investment> getInvestments() {
|
public List<Investment> getInvestments() {
|
||||||
return investments;
|
return investments;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,11 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.loader;
|
package org.hibernate.loader;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.assertSame;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
@ -32,13 +37,13 @@ import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.CollectionTable;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||||
|
@ -57,12 +62,7 @@ import org.hibernate.loader.spi.NoOpLoadPlanAdvisor;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.hibernate.testing.junit4.ExtraAssertions;
|
import org.hibernate.testing.junit4.ExtraAssertions;
|
||||||
|
import org.junit.Test;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertSame;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Gail Badner
|
* @author Gail Badner
|
||||||
|
@ -173,6 +173,7 @@ public class EntityWithNonLazyCollectionResultSetProcessorTest extends BaseCoreF
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private String name;
|
private String name;
|
||||||
@ElementCollection( fetch = FetchType.EAGER )
|
@ElementCollection( fetch = FetchType.EAGER )
|
||||||
|
@CollectionTable( name = "NickNames" )
|
||||||
private Set<String> nickNames = new HashSet<String>();
|
private Set<String> nickNames = new HashSet<String>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import javax.persistence.InheritanceType;
|
||||||
import javax.persistence.JoinColumn;
|
import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
|
|
||||||
@Entity(name="Comment")
|
@Entity(name="CommentTable") // "Comment" reserved in Oracle
|
||||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
@DiscriminatorColumn(name = "DTYPE", discriminatorType= DiscriminatorType.STRING, length = 3)
|
@DiscriminatorColumn(name = "DTYPE", discriminatorType= DiscriminatorType.STRING, length = 3)
|
||||||
@DiscriminatorValue(value = "WPT")
|
@DiscriminatorValue(value = "WPT")
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class ProxyInterfaceClassLoaderTest extends BaseCoreFunctionalTestCase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity( name = "Person" )
|
||||||
@Proxy(proxyClass = IPerson.class)
|
@Proxy(proxyClass = IPerson.class)
|
||||||
static class Person implements IPerson {
|
static class Person implements IPerson {
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class UserConfEntity implements Serializable{
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name="user_id")
|
@JoinColumn(name="user_id", nullable = false)
|
||||||
private UserEntity user;
|
private UserEntity user;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
|
|
@ -16,7 +16,7 @@ import javax.persistence.OrderColumn;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "USER")
|
@Table(name = "USERTABLE")
|
||||||
public class UserEntity implements Serializable{
|
public class UserEntity implements Serializable{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -30,7 +30,9 @@ import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||||
|
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.hibernate.testing.env.ConnectionProviderBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SessionFactory has to use the {@link CurrentTenantIdentifierResolver} when
|
* SessionFactory has to use the {@link CurrentTenantIdentifierResolver} when
|
||||||
|
@ -40,6 +42,7 @@ import org.hibernate.testing.TestForIssue;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-7306")
|
@TestForIssue(jiraKey = "HHH-7306")
|
||||||
|
@RequiresDialectFeature( value = ConnectionProviderBuilder.class )
|
||||||
public class CurrentTenantResolverMultiTenancyTest extends SchemaBasedMultiTenancyTest {
|
public class CurrentTenantResolverMultiTenancyTest extends SchemaBasedMultiTenancyTest {
|
||||||
|
|
||||||
private TestCurrentTenantIdentifierResolver currentTenantResolver = new TestCurrentTenantIdentifierResolver();
|
private TestCurrentTenantIdentifierResolver currentTenantResolver = new TestCurrentTenantIdentifierResolver();
|
||||||
|
|
|
@ -44,6 +44,7 @@ import org.hibernate.engine.jdbc.connections.spi.AbstractMultiTenantConnectionPr
|
||||||
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
|
||||||
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
|
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
|
||||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.cache.CachingRegionFactory;
|
import org.hibernate.testing.cache.CachingRegionFactory;
|
||||||
import org.hibernate.testing.env.ConnectionProviderBuilder;
|
import org.hibernate.testing.env.ConnectionProviderBuilder;
|
||||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||||
|
@ -53,6 +54,7 @@ import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@RequiresDialectFeature( value = ConnectionProviderBuilder.class )
|
||||||
public class SchemaBasedMultiTenancyTest extends BaseUnitTestCase {
|
public class SchemaBasedMultiTenancyTest extends BaseUnitTestCase {
|
||||||
private DriverManagerConnectionProviderImpl acmeProvider;
|
private DriverManagerConnectionProviderImpl acmeProvider;
|
||||||
private DriverManagerConnectionProviderImpl jbossProvider;
|
private DriverManagerConnectionProviderImpl jbossProvider;
|
||||||
|
|
|
@ -20,28 +20,38 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.schemavalidation;
|
package org.hibernate.test.schemavalidation;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import org.hibernate.Session;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.dialect.Oracle9iDialect;
|
import org.hibernate.dialect.Oracle9iDialect;
|
||||||
import org.hibernate.testing.RequiresDialect;
|
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.hibernate.tool.hbm2ddl.SchemaValidator;
|
||||||
import org.junit.Test;
|
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
|
* @author Brett Meyer
|
||||||
*/
|
*/
|
||||||
@RequiresDialect( Oracle9iDialect.class )
|
@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
|
@Test
|
||||||
public void testSynonymValidation() {
|
public void testSynonymValidation() {
|
||||||
// Session s = openSession();
|
// Session s = openSession();
|
||||||
|
@ -49,68 +59,21 @@ public class SynonymValidationTest extends BaseUnitTestCase {
|
||||||
// s.createSQLQuery( "CREATE SYNONYM test_synonym FOR test_entity" ).executeUpdate();
|
// s.createSQLQuery( "CREATE SYNONYM test_synonym FOR test_entity" ).executeUpdate();
|
||||||
// s.getTransaction().commit();
|
// s.getTransaction().commit();
|
||||||
// s.close();
|
// s.close();
|
||||||
|
//
|
||||||
Configuration cfg = new Configuration();
|
// Configuration cfg = new Configuration();
|
||||||
// cfg.addAnnotatedClass( TestEntityWithSynonym.class );
|
// cfg.addAnnotatedClass( TestEntityWithSynonym.class );
|
||||||
cfg.addAnnotatedClass( TestEntity.class );
|
// cfg.setProperty( AvailableSettings.ENABLE_SYNONYMS, "true" );
|
||||||
cfg.setProperty( AvailableSettings.ENABLE_SYNONYMS, "true" );
|
//
|
||||||
cfg.setProperty( "hibernate.connection.includeSynonyms", "true" );
|
// SchemaValidator schemaValidator = new SchemaValidator( cfg );
|
||||||
cfg.getProperties().put( "includeSynonyms", true );
|
// schemaValidator.validate();
|
||||||
|
//
|
||||||
// SchemaValidator schemaValidator = new SchemaValidator( serviceRegistry(), cfg );
|
|
||||||
SchemaValidator schemaValidator = new SchemaValidator( cfg );
|
|
||||||
schemaValidator.validate();
|
|
||||||
|
|
||||||
// s = openSession();
|
// s = openSession();
|
||||||
// s.getTransaction().begin();
|
// s.getTransaction().begin();
|
||||||
// s.createSQLQuery( "DROP SYNONYM test_synonym FORCE" ).executeUpdate();
|
// s.createSQLQuery( "DROP SYNONYM test_synonym FORCE" ).executeUpdate();
|
||||||
// s.getTransaction().commit();
|
// s.getTransaction().commit();
|
||||||
// s.close();
|
// 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
|
// @Entity
|
||||||
// @Table(name = "test_entity")
|
// @Table(name = "test_entity")
|
||||||
// private static class TestEntity {
|
// private static class TestEntity {
|
||||||
|
|
|
@ -27,18 +27,22 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.dialect.H2Dialect;
|
import org.hibernate.dialect.H2Dialect;
|
||||||
|
import org.hibernate.dialect.SQLServerDialect;
|
||||||
import org.hibernate.testing.SkipForDialect;
|
import org.hibernate.testing.SkipForDialect;
|
||||||
|
import org.hibernate.testing.SkipForDialects;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Strong Liu <stliu@hibernate.org>
|
* @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")
|
@TestForIssue( jiraKey = "HHH-8312")
|
||||||
public class CompositeIdTypeBindingTest extends BaseCoreFunctionalTestCase {
|
public class CompositeIdTypeBindingTest extends BaseCoreFunctionalTestCase {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
||||||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
||||||
<hibernate-mapping default-lazy="false">
|
<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"/>
|
<id name="id" type="long" column="id"/>
|
||||||
<property name="note" type="string"/>
|
<property name="note" type="string"/>
|
||||||
<dynamic-component name="customFields">
|
<dynamic-component name="customFields">
|
||||||
|
|
|
@ -27,15 +27,15 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
import org.hibernate.dialect.H2Dialect;
|
|
||||||
import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
|
import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
|
||||||
|
import org.hibernate.testing.DialectCheck;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the JDBC connection information (currently H2) used by Hibernate for unit (not functional!) tests
|
* Defines the JDBC connection information (currently H2) used by Hibernate for unit (not functional!) tests
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class ConnectionProviderBuilder {
|
public class ConnectionProviderBuilder implements DialectCheck {
|
||||||
public static final String DRIVER = "org.h2.Driver";
|
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 URL = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;MVCC=TRUE";
|
||||||
public static final String USER = "sa";
|
public static final String USER = "sa";
|
||||||
|
@ -79,4 +79,9 @@ public class ConnectionProviderBuilder {
|
||||||
public static Dialect getCorrespondingDialect() {
|
public static Dialect getCorrespondingDialect() {
|
||||||
return TestingDatabaseInfo.DIALECT;
|
return TestingDatabaseInfo.DIALECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMatch(Dialect dialect) {
|
||||||
|
return getCorrespondingDialect().getClass().equals( dialect.getClass() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue