import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* Sets up the unit test (H2) database for Camunda.
*/
public class CamundaDBSetup {
- private static boolean isDBConfigured = false;
- private static final Logger logger = LoggerFactory.getLogger(CamundaDBSetup.class);
-
- private CamundaDBSetup() {
- }
-
- public static synchronized void configure() throws SQLException {
- if (isDBConfigured) {
- return;
- }
+ private static boolean isDBConfigured = false;
+ private static final Logger logger = LoggerFactory.getLogger(CamundaDBSetup.class);
+
+ private CamundaDBSetup() {}
+
+ public static synchronized void configure() throws SQLException {
+ if (isDBConfigured) {
+ return;
+ }
+
+ logger.debug("Configuring the Camunda H2 database for MSO");
- logger.debug ("Configuring the Camunda H2 database for MSO");
+ Connection connection = null;
+ PreparedStatement stmt = null;
- Connection connection = null;
- PreparedStatement stmt = null;
+ try {
- try {
+ isDBConfigured = true;
- isDBConfigured = true;
-
- } finally {
- if (stmt != null) {
- try {
- stmt.close();
- } catch (Exception e) {
- logger.debug("Exception :",e);
- }
- }
+ } finally {
+ if (stmt != null) {
+ try {
+ stmt.close();
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ }
+ }
- if (connection != null) {
- try {
- connection.close();
- } catch (Exception e) {
- logger.debug("Exception :",e);
- }
- }
- }
- }
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (Exception e) {
+ logger.debug("Exception :", e);
+ }
+ }
+ }
+ }
}