quiet migration tasks during tests
also add description to schema initialization tasks
This commit is contained in:
parent
8d1d3cee75
commit
38bae8866b
|
@ -40,7 +40,7 @@ public class InitializeSchemaTask extends BaseTask<InitializeSchemaTask> {
|
|||
public InitializeSchemaTask(String theProductVersion, String theSchemaVersion, ISchemaInitializationProvider theSchemaInitializationProvider) {
|
||||
super(theProductVersion, theSchemaVersion);
|
||||
mySchemaInitializationProvider = theSchemaInitializationProvider;
|
||||
setDescription("Initialize schema");
|
||||
setDescription("Initialize schema for " + mySchemaInitializationProvider.getSchemaDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,13 +59,15 @@ public class InitializeSchemaTask extends BaseTask<InitializeSchemaTask> {
|
|||
return;
|
||||
}
|
||||
|
||||
logInfo(ourLog, "Initializing schema for {}", driverType);
|
||||
logInfo(ourLog, "Initializing {} schema for {}", driverType, mySchemaInitializationProvider.getSchemaDescription());
|
||||
|
||||
List<String> sqlStatements = mySchemaInitializationProvider.getSqlStatements(driverType);
|
||||
|
||||
for (String nextSql : sqlStatements) {
|
||||
executeSql(null, nextSql);
|
||||
}
|
||||
|
||||
logInfo(ourLog, "{} schema for {} initialized successfully", driverType, mySchemaInitializationProvider.getSchemaDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -904,7 +904,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
protected void init330() { // 20180114 - 20180329
|
||||
Builder version = forVersion(VersionEnum.V3_3_0);
|
||||
|
||||
version.initializeSchema("20180115.0", new SchemaInitializationProvider("/ca/uhn/hapi/fhir/jpa/docs/database", "HFJ_RESOURCE"));
|
||||
version.initializeSchema("20180115.0", new SchemaInitializationProvider("HAPI FHIR", "/ca/uhn/hapi/fhir/jpa/docs/database", "HFJ_RESOURCE"));
|
||||
|
||||
Builder.BuilderWithTableName hfjResource = version.onTable("HFJ_RESOURCE");
|
||||
version.startSectionWithMessage("Starting work on table: " + hfjResource.getTableName());
|
||||
|
|
|
@ -38,13 +38,16 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
|||
public class SchemaInitializationProvider implements ISchemaInitializationProvider {
|
||||
|
||||
private String mySchemaFileClassPath;
|
||||
|
||||
private String mySchemaDescription;
|
||||
private final String mySchemaExistsIndicatorTable;
|
||||
|
||||
/**
|
||||
* @param theSchemaFileClassPath pathname to script used to initialize schema
|
||||
* @param theSchemaExistsIndicatorTable a table name we can use to determine if this schema has already been initialized
|
||||
*/
|
||||
public SchemaInitializationProvider(String theSchemaFileClassPath, String theSchemaExistsIndicatorTable) {
|
||||
public SchemaInitializationProvider(String theSchemaDescription, String theSchemaFileClassPath, String theSchemaExistsIndicatorTable) {
|
||||
mySchemaDescription = theSchemaDescription;
|
||||
mySchemaFileClassPath = theSchemaFileClassPath;
|
||||
mySchemaExistsIndicatorTable = theSchemaExistsIndicatorTable;
|
||||
}
|
||||
|
@ -115,5 +118,16 @@ public class SchemaInitializationProvider implements ISchemaInitializationProvid
|
|||
mySchemaFileClassPath = theSchemaFileClassPath;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchemaDescription() {
|
||||
return mySchemaDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SchemaInitializationProvider setSchemaDescription(String theSchemaDescription) {
|
||||
mySchemaDescription = theSchemaDescription;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.migrate.tasks.api;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.migrate.DriverTypeEnum;
|
||||
import ca.uhn.fhir.jpa.migrate.tasks.SchemaInitializationProvider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -28,4 +29,8 @@ public interface ISchemaInitializationProvider {
|
|||
List<String> getSqlStatements(DriverTypeEnum theDriverType);
|
||||
|
||||
String getSchemaExistsIndicatorTable();
|
||||
|
||||
String getSchemaDescription();
|
||||
|
||||
SchemaInitializationProvider setSchemaDescription(String theSchemaDescription);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,11 @@ public class InitializeSchemaTaskTest extends BaseTest {
|
|||
return "DONT_MATCH_ME";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchemaDescription() {
|
||||
return "TEST";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object theO) {
|
||||
if (this == theO) return true;
|
||||
|
|
Loading…
Reference in New Issue