Created
October 21, 2019 19:42
-
-
Save steinarb/b0ced17a56614d0f5e99a7307f4fb298 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component(service=UkelonnDatabase.class, immediate=true) | |
public class UkelonnDatabaseProvider implements UkelonnDatabase { | |
@Activate | |
public void activate() { | |
createDatasource(); | |
UkelonnLiquibase liquibase = new UkelonnLiquibase(); | |
try(Connection connect = getConnection()) { | |
try { | |
liquibase.createInitialSchema(connect); | |
insertMockData(); | |
liquibase.updateSchema(connect); | |
} finally { | |
// Liquibase sets Connection.autoCommit to false, set it back to true | |
connect.setAutoCommit(true); | |
} | |
} catch (Exception e) { | |
logError("Failed to create derby test database schema", e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment