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);
16 public static synchronized void configure() throws SQLException {
21 System.out.println("Configuring the Camunda H2 database for MSO");
23 Connection connection = null;
24 PreparedStatement stmt = null;
27 connection = DriverManager.getConnection(
28 "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", "");
30 stmt = connection.prepareStatement("delete from ACT_HI_VARINST");
35 stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob");
40 // stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob");
41 // stmt.executeUpdate();
45 stmt = connection.prepareStatement("delete from ACT_HI_DETAIL");
50 stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob");
55 // stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob");
56 // stmt.executeUpdate();
60 stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob");
68 isDBConfigured = true;
69 } catch (SQLException e) {
70 System.out.println("CamundaDBSetup caught " + e.getClass().getSimpleName());
71 LOGGER.debug("SQLException :",e);
76 } catch (Exception e) {
77 LOGGER.debug("Exception :",e);
81 if (connection != null) {
84 } catch (Exception e) {
85 LOGGER.debug("Exception :",e);