This commit is contained in:
Ken Stevens 2019-11-26 16:57:59 -05:00
parent 8b03e5f83b
commit 7593b7f8f7
2 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@ public class SchemaMigratorTest extends BaseTest {
task.addSql(DriverTypeEnum.H2_EMBEDDED, "create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))"); task.addSql(DriverTypeEnum.H2_EMBEDDED, "create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
getMigrator().addTask(task); getMigrator().addTask(task);
SchemaMigrator schemaMigrator = new SchemaMigrator(BaseTest.TEST_MIGRATION_TABLE, getDataSource(), new Properties(), Collections.singletonList(task)); SchemaMigrator schemaMigrator = new SchemaMigrator(SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME, getDataSource(), new Properties(), Collections.singletonList(task));
try { try {
schemaMigrator.validate(); schemaMigrator.validate();

View File

@ -3,6 +3,7 @@ package ca.uhn.fhir.jpa.migrate.taskdef;
import ca.uhn.fhir.jpa.migrate.DriverTypeEnum; import ca.uhn.fhir.jpa.migrate.DriverTypeEnum;
import ca.uhn.fhir.jpa.migrate.FlywayMigrator; import ca.uhn.fhir.jpa.migrate.FlywayMigrator;
import ca.uhn.fhir.jpa.migrate.JdbcUtils; import ca.uhn.fhir.jpa.migrate.JdbcUtils;
import ca.uhn.fhir.jpa.migrate.SchemaMigrator;
import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.BasicDataSource;
import org.intellij.lang.annotations.Language; import org.intellij.lang.annotations.Language;
import org.junit.After; import org.junit.After;
@ -16,7 +17,6 @@ import java.util.Set;
public class BaseTest { public class BaseTest {
public static final String TEST_MIGRATION_TABLE = "TEST_MIGRATION";
private static final String DATABASE_NAME = "DATABASE"; private static final String DATABASE_NAME = "DATABASE";
private static int ourDatabaseUrl = 0; private static int ourDatabaseUrl = 0;
private String myUrl; private String myUrl;
@ -42,7 +42,7 @@ public class BaseTest {
myDataSource.setUsername("SA"); myDataSource.setUsername("SA");
myDataSource.setPassword("SA"); myDataSource.setPassword("SA");
myDataSource.setDriverClassName(DriverTypeEnum.H2_EMBEDDED.getDriverClassName()); myDataSource.setDriverClassName(DriverTypeEnum.H2_EMBEDDED.getDriverClassName());
myMigrator = new FlywayMigrator(TEST_MIGRATION_TABLE, myDataSource); myMigrator = new FlywayMigrator(SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME, myDataSource);
} }
protected BasicDataSource getDataSource() { protected BasicDataSource getDataSource() {
@ -52,8 +52,8 @@ public class BaseTest {
@After @After
public void resetMigrationVersion() throws SQLException { public void resetMigrationVersion() throws SQLException {
Set<String> tableNames = JdbcUtils.getTableNames(getConnectionProperties()); Set<String> tableNames = JdbcUtils.getTableNames(getConnectionProperties());
if (tableNames.contains(TEST_MIGRATION_TABLE)) { if (tableNames.contains(SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME)) {
executeSql("DELETE from " + TEST_MIGRATION_TABLE + " where \"installed_rank\" > 0"); executeSql("DELETE from " + SchemaMigrator.HAPI_FHIR_MIGRATION_TABLENAME + " where \"installed_rank\" > 0");
} }
} }