use of liquibase.resource.ClassLoaderResourceAccessor in project microservice_framework by CJSCommonPlatform.
the class EventBufferAndFilterChainIT method initDatabase.
private void initDatabase() throws Exception {
Liquibase liquibase = new Liquibase(LIQUIBASE_STREAM_STATUS_CHANGELOG_XML, new ClassLoaderResourceAccessor(), new JdbcConnection(dataSource.getConnection()));
liquibase.dropAll();
liquibase.update("");
}
use of liquibase.resource.ClassLoaderResourceAccessor in project microservice_framework by CJSCommonPlatform.
the class EventStreamPageIT method initEventDatabase.
private void initEventDatabase() throws Exception {
Liquibase eventStoreLiquibase = new Liquibase(LIQUIBASE_EVENT_STORE_CHANGELOG_XML, new ClassLoaderResourceAccessor(), new JdbcConnection(dataSource.getConnection()));
eventStoreLiquibase.dropAll();
eventStoreLiquibase.update("");
}
use of liquibase.resource.ClassLoaderResourceAccessor in project activityinfo by bedatadriven.
the class TestConnectionProvider method initializeDatabase.
private static void initializeDatabase() throws SQLException, LiquibaseException {
Connection connection;
try {
connection = DriverManager.getConnection(connectionUrl(DATABASE_NAME), USERNAME, PASSWORD);
Statement stmt = connection.createStatement();
stmt.execute("DROP DATABASE IF EXISTS " + DATABASE_NAME);
stmt.execute("CREATE DATABASE " + DATABASE_NAME);
stmt.execute("USE " + DATABASE_NAME);
} catch (SQLException e) {
// Database probably doesn't exist yet
connection = DriverManager.getConnection(connectionUrl(""), USERNAME, PASSWORD);
Statement stmt = connection.createStatement();
stmt.execute("CREATE DATABASE " + DATABASE_NAME);
stmt.close();
connection.close();
// Re-open specifically for this database
connection = DriverManager.getConnection(connectionUrl(DATABASE_NAME), USERNAME, PASSWORD);
}
Liquibase liquibase = new Liquibase("org/activityinfo/database/changelog/db.changelog-master.xml", new ClassLoaderResourceAccessor(), new JdbcConnection(connection));
liquibase.update(new Contexts());
connection.close();
}
use of liquibase.resource.ClassLoaderResourceAccessor in project cals-api by ca-cwds.
the class DatabaseHelper method runScript.
public void runScript(String script, Map<String, Object> parameters, String schema) throws LiquibaseException {
try {
String defaultSchema = getDatabase().getDefaultSchemaName();
getDatabase().setDefaultSchemaName(schema);
Liquibase liquibase = new Liquibase(script, new ClassLoaderResourceAccessor(), getDatabase());
parameters.forEach(liquibase::setChangeLogParameter);
liquibase.update((String) null);
getDatabase().setDefaultSchemaName(defaultSchema);
} catch (Exception e) {
throw new LiquibaseException(e);
}
}
use of liquibase.resource.ClassLoaderResourceAccessor in project liquibase by liquibase.
the class Scope method getCurrentScope.
public static Scope getCurrentScope() {
if (scopeManager == null) {
scopeManager = new SingletonScopeManager();
}
if (scopeManager.getCurrentScope() == null) {
Scope rootScope = new Scope();
scopeManager.setCurrentScope(rootScope);
rootScope.values.put(Attr.logService.name(), new JavaLogService());
rootScope.values.put(Attr.resourceAccessor.name(), new ClassLoaderResourceAccessor());
rootScope.values.put(Attr.serviceLocator.name(), new StandardServiceLocator());
rootScope.values.put(Attr.ui.name(), new ConsoleUIService());
rootScope.getSingleton(LiquibaseConfiguration.class).init(rootScope);
LogService overrideLogService = rootScope.getSingleton(LogServiceFactory.class).getDefaultLogService();
if (overrideLogService == null) {
throw new UnexpectedLiquibaseException("Cannot find default log service");
}
rootScope.values.put(Attr.logService.name(), overrideLogService);
// check for higher-priority serviceLocator
ServiceLocator serviceLocator = rootScope.getServiceLocator();
for (ServiceLocator possibleLocator : serviceLocator.findInstances(ServiceLocator.class)) {
if (possibleLocator.getPriority() > serviceLocator.getPriority()) {
serviceLocator = possibleLocator;
}
}
rootScope.values.put(Attr.serviceLocator.name(), serviceLocator);
rootScope.values.put(Attr.osgiPlatform.name(), Activator.OSGIContainerChecker.isOsgiPlatform());
}
return scopeManager.getCurrentScope();
}
Aggregations