HHH-11448 - Fix tests failing on PostgreSQL

This commit is contained in:
Vlad Mihalcea 2017-02-02 17:22:49 +02:00
parent a4125ad28e
commit 517fc4c242
7 changed files with 38 additions and 3 deletions

View File

@ -60,6 +60,9 @@ public class EmbeddableWithManyToMany_HHH_11302_Test
"@OneToMany, @ManyToMany or @ElementCollection cannot be used inside an @Embeddable that is also contained within an @ElementCollection"
) );
}
finally {
serviceRegistry().destroy();
}
}
@Test

View File

@ -60,6 +60,9 @@ public class EmbeddableWithOneToMany_HHH_11302_Test
"@OneToMany, @ManyToMany or @ElementCollection cannot be used inside an @Embeddable that is also contained within an @ElementCollection"
) );
}
finally {
serviceRegistry().destroy();
}
}
@Test

View File

@ -55,6 +55,9 @@ public class EmbeddableWithOneToMany_HHH_8564_Test
"@OneToMany, @ManyToMany or @ElementCollection cannot be used inside an @Embeddable that is also contained within an @ElementCollection"
) );
}
finally {
serviceRegistry().destroy();
}
}
@Test

View File

@ -53,6 +53,9 @@ public class EmbeddableWithOneToMany_HHH_8860_Test
"@OneToMany, @ManyToMany or @ElementCollection cannot be used inside an @Embeddable that is also contained within an @ElementCollection"
) );
}
finally {
serviceRegistry().destroy();
}
}
@Test

View File

@ -6,10 +6,14 @@
*/
package org.hibernate.test.annotations.embeddables.collection.xml;
import java.util.Map;
import org.hibernate.AnnotationException;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.TestForIssue;
import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
@ -22,6 +26,8 @@ import static org.junit.Assert.fail;
public class EmbeddableWithOneToMany_HHH_11302_xml_Test extends
BaseEntityManagerFunctionalTestCase {
PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider();
@Override
public String[] getEjb3DD() {
return new String[] {
@ -39,6 +45,15 @@ public class EmbeddableWithOneToMany_HHH_11302_xml_Test extends
"@OneToMany, @ManyToMany or @ElementCollection cannot be used inside an @Embeddable that is also contained within an @ElementCollection"
) );
}
finally {
connectionProvider.stop();
}
}
protected Map buildSettings() {
Map settings = super.buildSettings();
settings.put( AvailableSettings.CONNECTION_PROVIDER, connectionProvider );
return settings;
}
@Test

View File

@ -127,7 +127,12 @@ public class HQLTest extends QueryTranslatorTestCase {
}
@Test
@SkipForDialect( value = { Oracle8iDialect.class, AbstractHANADialect.class } )
@SkipForDialect( value = {
Oracle8iDialect.class,
AbstractHANADialect.class,
PostgreSQL81Dialect.class,
MySQLDialect.class
} )
public void testRowValueConstructorSyntaxInInListBeingTranslated() {
QueryTranslatorImpl translator = createNewQueryTranslator("from LineItem l where l.id in (?)");
assertInExist("'in' should be translated to 'and'", false, translator);

View File

@ -17,6 +17,7 @@ import javax.transaction.Transaction;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl;
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
import org.hibernate.tool.schema.SourceType;
@ -79,9 +80,9 @@ public class SchemaToolTransactionHandlingTest extends BaseUnitTestCase {
throw new RuntimeException( "Unable to access JTA Transaction prior to starting test", e );
}
final StandardServiceRegistry registry = buildJtaStandardServiceRegistry();
// perform the test...
try {
final StandardServiceRegistry registry = buildJtaStandardServiceRegistry();
final SchemaManagementTool smt = registry.getService( SchemaManagementTool.class );
final SchemaDropper schemaDropper = smt.getSchemaDropper( Collections.emptyMap() );
final SchemaCreator schemaCreator = smt.getSchemaCreator( Collections.emptyMap() );
@ -118,6 +119,7 @@ public class SchemaToolTransactionHandlingTest extends BaseUnitTestCase {
finally {
try {
jtaTransaction.commit();
((StandardServiceRegistryImpl) registry).destroy();
}
catch (Exception e) {
// not much we can do...
@ -146,9 +148,9 @@ public class SchemaToolTransactionHandlingTest extends BaseUnitTestCase {
throw new RuntimeException( "Unable to access JTA Transaction prior to starting test", e );
}
final StandardServiceRegistry registry = buildJtaStandardServiceRegistry();
// perform the test...
try {
final StandardServiceRegistry registry = buildJtaStandardServiceRegistry();
final SchemaManagementTool smt = registry.getService( SchemaManagementTool.class );
final Metadata mappings = buildMappings( registry );
@ -189,6 +191,7 @@ public class SchemaToolTransactionHandlingTest extends BaseUnitTestCase {
finally {
try {
jtaTransaction.commit();
((StandardServiceRegistryImpl) registry).destroy();
}
catch (Exception e) {
// not much we can do...