1 package org.openecomp.mso.bpmn.core;
3 import java.sql.Connection;
4 import java.sql.DriverManager;
5 import java.sql.PreparedStatement;
6 import java.sql.SQLException;
8 import org.openecomp.mso.logger.MsoLogger;
11 * Sets up the unit test (H2) database for Camunda.
13 public class CamundaDBSetup {
14 private static boolean isDBConfigured = false;
15 private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
17 private CamundaDBSetup() {
23 public static synchronized void configure() throws SQLException {
28 LOGGER.debug ("Configuring the Camunda H2 database for MSO");
30 Connection connection = null;
31 PreparedStatement stmt = null;
34 connection = DriverManager.getConnection(
35 "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", "");
37 stmt = connection.prepareStatement("delete from ACT_HI_VARINST");
42 stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob");
47 // stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob");
48 // stmt.executeUpdate();
52 stmt = connection.prepareStatement("delete from ACT_HI_DETAIL");
57 stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob");
62 // stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob");
63 // stmt.executeUpdate();
67 stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob");
75 isDBConfigured = true;
76 } catch (SQLException e) {
77 LOGGER.debug ("CamundaDBSetup caught " + e.getClass().getSimpleName());
78 LOGGER.debug("SQLException :",e);
83 } catch (Exception e) {
84 LOGGER.debug("Exception :",e);
88 if (connection != null) {
91 } catch (Exception e) {
92 LOGGER.debug("Exception :",e);