hibernateSchemaUpdate(true);
}
private void hibernateSchemaUpdate(boolean enhancedId) throws Exception {
Liquibase liquibase = new Liquibase((String) null, new ClassLoaderResourceAccessor(), database);
Database hibernateDatabase = new HibernateSpringDatabase();
hibernateDatabase.setDefaultSchemaName("PUBLIC");
hibernateDatabase.setDefaultCatalogName("TESTDB");
hibernateDatabase.setConnection(new JdbcConnection(new HibernateConnection("hibernate:spring:" + PACKAGES + "?dialect="
+ HSQLDialect.class.getName()
+ "&hibernate.enhanced_id=" + (enhancedId ? "true" : "false"))));
DiffResult diffResult = liquibase.diff(hibernateDatabase, database, compareControl);
assertTrue(diffResult.getMissingObjects().size() > 0);
File outFile = File.createTempFile("lb-test", ".xml");
OutputStream outChangeLog = new FileOutputStream(outFile);
String changeLogString = toChangeLog(diffResult);
outChangeLog.write(changeLogString.getBytes("UTF-8"));
outChangeLog.close();
log.info("Changelog:\n" + changeLogString);
liquibase = new Liquibase(outFile.toString(), new FileSystemResourceAccessor(), database);
StringWriter stringWriter = new StringWriter();
liquibase.update((String) null, stringWriter);
log.info(stringWriter.toString());
liquibase.update((String) null);
long currentTimeMillis = System.currentTimeMillis();
Connection connection2 = DriverManager.getConnection("jdbc:hsqldb:mem:TESTDB2" + currentTimeMillis, "SA", "");
Database database2 = new HsqlDatabase();
database2.setConnection(new JdbcConnection(connection2));
Configuration cfg = createSpringPackageScanningConfiguration(enhancedId);
cfg.setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:TESTDB2" + currentTimeMillis);
SchemaUpdate update = new SchemaUpdate(cfg);
update.execute(true, true);
diffResult = liquibase.diff(database, database2, compareControl);
ignoreDatabaseChangeLogTable(diffResult);
ignoreConversionFromFloatToDouble64(diffResult);
String differences = toString(diffResult);