mirror of
https://github.com/google/nomulus
synced 2026-09-19 14:34:18 +00:00
Fix flakiness in JodaMoneyConverterTest (#421)
* Fix flakiness in JodaMoneyConverterTest JpdaMoneyConverterTest relies on Hibernate to deploy its schema. This introduces an extra jdbc connection in the middle of a test suite, and may break the connection count checks between tests made by JpaTransactionManagerRule. This change updated HibernateSchemaExporter to include Hibernate proprietary mappings in META-INF/orm.xml. This change also disabled Hibernate schema push for all tests, and enabled sql statement logging.
This commit is contained in:
@@ -32,6 +32,9 @@ import org.hibernate.tool.schema.TargetType;
|
||||
|
||||
/** Utility class to export DDL script for given {@link javax.persistence.Entity} classes. */
|
||||
public class HibernateSchemaExporter {
|
||||
// Hibernate proprietary mappings.
|
||||
private static final String HIBERNATE_MAPPING_RESOURCES = "META-INF/orm.xml";
|
||||
|
||||
private final String jdbcUrl;
|
||||
private final String username;
|
||||
private final String password;
|
||||
@@ -63,6 +66,7 @@ public class HibernateSchemaExporter {
|
||||
try (StandardServiceRegistry registry =
|
||||
new StandardServiceRegistryBuilder().applySettings(settings).build()) {
|
||||
MetadataSources metadata = new MetadataSources(registry);
|
||||
metadata.addResource(HIBERNATE_MAPPING_RESOURCES);
|
||||
|
||||
// Note that we need to also add all converters to the Hibernate context because
|
||||
// the entity class may use the customized type.
|
||||
|
||||
Reference in New Issue
Block a user