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;
9 * Sets up the unit test (H2) database for Camunda.
11 public class CamundaDBSetup {
12 private static boolean isDBConfigured = false;
14 public static synchronized void configure() throws SQLException {
19 System.out.println("Configuring the Camunda H2 database for MSO");
21 Connection connection = null;
22 PreparedStatement stmt = null;
25 connection = DriverManager.getConnection(
26 "jdbc:h2:mem:camunda;DB_CLOSE_DELAY=-1", "sa", "");
28 stmt = connection.prepareStatement("delete from ACT_HI_VARINST");
33 stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column TEXT_ clob");
38 // stmt = connection.prepareStatement("ALTER TABLE ACT_HI_VARINST alter column NAME_ clob");
39 // stmt.executeUpdate();
43 stmt = connection.prepareStatement("delete from ACT_HI_DETAIL");
48 stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column TEXT_ clob");
53 // stmt = connection.prepareStatement("ALTER TABLE ACT_HI_DETAIL alter column NAME_ clob");
54 // stmt.executeUpdate();
58 stmt = connection.prepareStatement("ALTER TABLE ACT_RU_VARIABLE alter column TEXT_ clob");
66 isDBConfigured = true;
67 } catch (SQLException e) {
68 System.out.println("CamundaDBSetup caught " + e.getClass().getSimpleName());
74 } catch (Exception e) {
79 if (connection != null) {
82 } catch (Exception e) {