|
29 | 29 |
|
30 | 30 | import org.hibernate.cfg.AvailableSettings;
|
31 | 31 | import org.hibernate.cfg.Environment;
|
| 32 | +import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; |
| 33 | +import org.hibernate.resource.transaction.spi.TransactionCoordinator; |
| 34 | +import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder; |
| 35 | +import org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner; |
32 | 36 | import org.hibernate.tool.api.export.ArtifactCollector;
|
33 | 37 | import org.hibernate.tool.api.export.Exporter;
|
34 | 38 | import org.hibernate.tool.api.export.ExporterConstants;
|
|
49 | 53 | */
|
50 | 54 | public class TestCase {
|
51 | 55 |
|
| 56 | + @SuppressWarnings("serial") |
| 57 | + public static class FakeTransactionManagerLookup implements TransactionCoordinatorBuilder { |
| 58 | + @Override |
| 59 | + public TransactionCoordinator buildTransactionCoordinator(TransactionCoordinatorOwner owner, Options options) { |
| 60 | + return null; |
| 61 | + } |
| 62 | + @Override |
| 63 | + public boolean isJta() { |
| 64 | + return false; |
| 65 | + } |
| 66 | + @Override |
| 67 | + public PhysicalConnectionHandlingMode getDefaultConnectionHandlingMode() { |
| 68 | + return PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT; |
| 69 | + } |
| 70 | + } |
| 71 | + |
52 | 72 | private static final String[] HBM_XML_FILES = new String[] {
|
53 | 73 | "HelloWorld.hbm.xml"
|
54 | 74 | };
|
@@ -114,18 +134,18 @@ public void testMagicPropertyHandling() {
|
114 | 134 | FileUtil.findFirstString( Environment.HBM2DDL_AUTO, file ));
|
115 | 135 | exporter = ExporterFactory.createExporter(ExporterType.CFG);
|
116 | 136 | properties = exporter.getProperties();
|
117 |
| - properties.put( AvailableSettings.TRANSACTION_COORDINATOR_STRATEGY, "org.hibernate.console.FakeTransactionManagerLookup"); // Hack for seam-gen console configurations |
| 137 | + properties.put( AvailableSettings.TRANSACTION_COORDINATOR_STRATEGY, FakeTransactionManagerLookup.class.getName()); // Hack for seam-gen console configurations |
118 | 138 | properties.put(AvailableSettings.DIALECT, HibernateUtil.Dialect.class.getName());
|
119 | 139 | properties.put(AvailableSettings.CONNECTION_PROVIDER, HibernateUtil.ConnectionProvider.class.getName());
|
120 | 140 | exporter.getProperties().put(
|
121 | 141 | ExporterConstants.METADATA_DESCRIPTOR,
|
122 | 142 | MetadataDescriptorFactory.createNativeDescriptor(null, null, properties));
|
123 | 143 | exporter.getProperties().put(ExporterConstants.DESTINATION_FOLDER, srcDir);
|
124 | 144 | exporter.start();
|
125 |
| - assertNull( |
| 145 | + assertNotNull( |
126 | 146 | FileUtil.findFirstString( AvailableSettings.TRANSACTION_COORDINATOR_STRATEGY, file ));
|
127 | 147 | }
|
128 |
| - |
| 148 | + |
129 | 149 | @Test
|
130 | 150 | public void testFileExistence() {
|
131 | 151 | JUnitUtil.assertIsNonEmptyFile(new File(srcDir, "hibernate.cfg.xml") );
|
|
0 commit comments