Skip to content

Commit 2d85d84

Browse files
committed
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
1 parent 2fa9a6c commit 2d85d84

File tree

10 files changed

+46
-67
lines changed

10 files changed

+46
-67
lines changed

hibernate-core/src/test/java/org/hibernate/test/annotations/onetomany/Comment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import javax.persistence.JoinColumn;
1515
import javax.persistence.ManyToOne;
1616

17-
@Entity(name="Comment")
17+
@Entity(name="CommentTable") // "Comment" reserved in Oracle
1818
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
1919
@DiscriminatorColumn(name = "DTYPE", discriminatorType= DiscriminatorType.STRING, length = 3)
2020
@DiscriminatorValue(value = "WPT")

hibernate-core/src/test/java/org/hibernate/test/classloader/ProxyInterfaceClassLoaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ interface IPerson {
8080

8181
}
8282

83-
@Entity
83+
@Entity( name = "Person" )
8484
@Proxy(proxyClass = IPerson.class)
8585
static class Person implements IPerson {
8686

hibernate-core/src/test/java/org/hibernate/test/mapping/UserConfEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class UserConfEntity implements Serializable{
1919

2020
@Id
2121
@ManyToOne
22-
@JoinColumn(name="user_id")
22+
@JoinColumn(name="user_id", nullable = false)
2323
private UserEntity user;
2424

2525
@Id

hibernate-core/src/test/java/org/hibernate/test/mapping/UserEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import javax.persistence.Table;
1717

1818
@Entity
19-
@Table(name = "USER")
19+
@Table(name = "USERTABLE")
2020
public class UserEntity implements Serializable{
2121

2222
private static final long serialVersionUID = 1L;

hibernate-core/src/test/java/org/hibernate/test/multitenancy/schema/CurrentTenantResolverMultiTenancyTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
import org.hibernate.cfg.Configuration;
3131
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
3232

33+
import org.hibernate.testing.RequiresDialectFeature;
3334
import org.hibernate.testing.TestForIssue;
35+
import org.hibernate.testing.env.ConnectionProviderBuilder;
3436

3537
/**
3638
* SessionFactory has to use the {@link CurrentTenantIdentifierResolver} when
@@ -40,6 +42,7 @@
4042
* @author Steve Ebersole
4143
*/
4244
@TestForIssue(jiraKey = "HHH-7306")
45+
@RequiresDialectFeature( value = ConnectionProviderBuilder.class )
4346
public class CurrentTenantResolverMultiTenancyTest extends SchemaBasedMultiTenancyTest {
4447

4548
private TestCurrentTenantIdentifierResolver currentTenantResolver = new TestCurrentTenantIdentifierResolver();

hibernate-core/src/test/java/org/hibernate/test/multitenancy/schema/SchemaBasedMultiTenancyTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
4545
import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider;
4646
import org.hibernate.service.spi.ServiceRegistryImplementor;
47+
import org.hibernate.testing.RequiresDialectFeature;
4748
import org.hibernate.testing.cache.CachingRegionFactory;
4849
import org.hibernate.testing.env.ConnectionProviderBuilder;
4950
import org.hibernate.testing.junit4.BaseUnitTestCase;
@@ -53,6 +54,7 @@
5354
/**
5455
* @author Steve Ebersole
5556
*/
57+
@RequiresDialectFeature( value = ConnectionProviderBuilder.class )
5658
public class SchemaBasedMultiTenancyTest extends BaseUnitTestCase {
5759
private DriverManagerConnectionProviderImpl acmeProvider;
5860
private DriverManagerConnectionProviderImpl jbossProvider;

hibernate-core/src/test/java/org/hibernate/test/schemavalidation/SynonymValidationTest.java

Lines changed: 22 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -20,97 +20,60 @@
2020
*/
2121
package org.hibernate.test.schemavalidation;
2222

23-
import java.io.Serializable;
24-
2523
import javax.persistence.Column;
2624
import javax.persistence.Entity;
2725
import javax.persistence.GeneratedValue;
2826
import javax.persistence.Id;
2927
import javax.persistence.Table;
3028

29+
import org.hibernate.Session;
3130
import org.hibernate.cfg.AvailableSettings;
3231
import org.hibernate.cfg.Configuration;
3332
import org.hibernate.dialect.Oracle9iDialect;
3433
import org.hibernate.testing.RequiresDialect;
35-
import org.hibernate.testing.junit4.BaseUnitTestCase;
34+
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
3635
import org.hibernate.tool.hbm2ddl.SchemaValidator;
3736
import org.junit.Test;
3837

3938
/**
39+
* Allows the BaseCoreFunctionalTestCase to create the schema using TestEntity. The test method validates against an
40+
* identical entity, but using the synonym name.
41+
*
4042
* @author Brett Meyer
4143
*/
4244
@RequiresDialect( Oracle9iDialect.class )
43-
public class SynonymValidationTest extends BaseUnitTestCase {
45+
public class SynonymValidationTest extends BaseCoreFunctionalTestCase {
46+
47+
// TODO: The QA database matrix does not currently have sufficient permissions to be able to create synonyms.
48+
// Until resolved, disable.
4449

50+
// @Override
51+
// protected Class<?>[] getAnnotatedClasses() {
52+
// return new Class<?>[] { TestEntity.class };
53+
// }
54+
//
4555
@Test
4656
public void testSynonymValidation() {
4757
// Session s = openSession();
4858
// s.getTransaction().begin();
4959
// s.createSQLQuery( "CREATE SYNONYM test_synonym FOR test_entity" ).executeUpdate();
5060
// s.getTransaction().commit();
5161
// s.close();
52-
53-
Configuration cfg = new Configuration();
62+
//
63+
// Configuration cfg = new Configuration();
5464
// cfg.addAnnotatedClass( TestEntityWithSynonym.class );
55-
cfg.addAnnotatedClass( TestEntity.class );
56-
cfg.setProperty( AvailableSettings.ENABLE_SYNONYMS, "true" );
57-
cfg.setProperty( "hibernate.connection.includeSynonyms", "true" );
58-
cfg.getProperties().put( "includeSynonyms", true );
59-
60-
// SchemaValidator schemaValidator = new SchemaValidator( serviceRegistry(), cfg );
61-
SchemaValidator schemaValidator = new SchemaValidator( cfg );
62-
schemaValidator.validate();
63-
65+
// cfg.setProperty( AvailableSettings.ENABLE_SYNONYMS, "true" );
66+
//
67+
// SchemaValidator schemaValidator = new SchemaValidator( cfg );
68+
// schemaValidator.validate();
69+
//
6470
// s = openSession();
6571
// s.getTransaction().begin();
6672
// s.createSQLQuery( "DROP SYNONYM test_synonym FORCE" ).executeUpdate();
6773
// s.getTransaction().commit();
6874
// s.close();
6975
}
70-
71-
// protected Class<?>[] getAnnotatedClasses() {
72-
// return new Class<?>[] { TestEntity.class };
73-
// }
74-
75-
@Entity
76-
@Table(name = "TEST_SYN")
77-
private static class TestEntity implements Serializable {
78-
79-
private static final long serialVersionUID = 1L;
80-
81-
@Id
82-
@GeneratedValue
83-
private Long id;
84-
85-
@Column(nullable = false)
86-
private String key;
87-
private String value;
88-
89-
public Long getId() {
90-
return id;
91-
}
92-
93-
public void setId(Long id) {
94-
this.id = id;
95-
}
96-
97-
public String getKey() {
98-
return key;
99-
}
100-
101-
public void setKey(String key) {
102-
this.key = key;
103-
}
104-
105-
public String getValue() {
106-
return value;
107-
}
108-
109-
public void setValue(String value) {
110-
this.value = value;
111-
}
112-
}
113-
76+
//
11477
// @Entity
11578
// @Table(name = "test_entity")
11679
// private static class TestEntity {

hibernate-core/src/test/java/org/hibernate/test/subselect/CompositeIdTypeBindingTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,22 @@
2727
import java.util.List;
2828

2929
import junit.framework.Assert;
30-
import org.junit.Test;
3130

3231
import org.hibernate.Session;
3332
import org.hibernate.dialect.H2Dialect;
33+
import org.hibernate.dialect.SQLServerDialect;
3434
import org.hibernate.testing.SkipForDialect;
35+
import org.hibernate.testing.SkipForDialects;
3536
import org.hibernate.testing.TestForIssue;
3637
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
38+
import org.junit.Test;
3739

3840
/**
3941
* @author Strong Liu <[email protected]>
4042
*/
41-
@SkipForDialect(value = H2Dialect.class, comment = "H2 doesn't support this sql syntax")
43+
@SkipForDialects({
44+
@SkipForDialect(value = H2Dialect.class, comment = "H2 doesn't support this sql syntax"),
45+
@SkipForDialect(value = SQLServerDialect.class, comment = "mssql doesn't support multiple columns in the 'where' clause of a 'where in' query")})
4246
@TestForIssue( jiraKey = "HHH-8312")
4347
public class CompositeIdTypeBindingTest extends BaseCoreFunctionalTestCase {
4448
@Override

hibernate-envers/src/test/resources/mappings/dynamicComponents/mapNotAudited.hbm.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
44
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
55
<hibernate-mapping default-lazy="false">
6-
<class name="org.hibernate.envers.test.integration.components.dynamic.NotAuditedDynamicMapComponent">
6+
<!-- shortened table name for Oracle -->
7+
<class name="org.hibernate.envers.test.integration.components.dynamic.NotAuditedDynamicMapComponent" table="NotAudited">
78
<id name="id" type="long" column="id"/>
89
<property name="note" type="string"/>
910
<dynamic-component name="customFields">

hibernate-testing/src/main/java/org/hibernate/testing/env/ConnectionProviderBuilder.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@
2929
import org.hibernate.dialect.Dialect;
3030
import org.hibernate.dialect.H2Dialect;
3131
import org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
32+
import org.hibernate.testing.DialectCheck;
3233

3334
/**
3435
* Defines the JDBC connection information (currently H2) used by Hibernate for unit (not functional!) tests
3536
*
3637
* @author Steve Ebersole
3738
*/
38-
public class ConnectionProviderBuilder {
39+
public class ConnectionProviderBuilder implements DialectCheck {
3940
public static final String DRIVER = "org.h2.Driver";
4041
public static final String URL = "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;MVCC=TRUE";
4142
public static final String USER = "sa";
@@ -79,4 +80,9 @@ public boolean supportsAggressiveRelease() {
7980
public static Dialect getCorrespondingDialect() {
8081
return new H2Dialect();
8182
}
83+
84+
@Override
85+
public boolean isMatch(Dialect dialect) {
86+
return getCorrespondingDialect().getClass().equals( dialect.getClass() );
87+
}
8288
}

0 commit comments

Comments
 (0)