summaryrefslogtreecommitdiffstats
path: root/extra
diff options
context:
space:
mode:
authorChrisC <cc697w@intl.att.com>2017-06-21 02:38:57 -0700
committerChrisC <cc697w@intl.att.com>2017-06-21 02:58:20 -0700
commit5e9feb2a8e360b82dc2b6e4145e0fd847d2924ce (patch)
tree0c9e78d462252e5c41c977476c9dee26b1b0069b /extra
parent4d8ae6fe89a9ed6cd9a64c3276d2dc5a48bbcc34 (diff)
[CLAMP-1] Initial ONAP CLAMP seed code commit
Change-Id: I2e8070a590618a06070f393d7b2c011029af5e8a Signed-off-by: ChrisC <cc697w@intl.att.com>
Diffstat (limited to 'extra')
-rw-r--r--extra/docker/clamp/clamp.env1
-rw-r--r--extra/docker/clamp/docker-compose.yml22
-rw-r--r--extra/docker/mariadb/conf1/my.cnf194
-rw-r--r--extra/docker/mariadb/conf2/my.cnf193
-rw-r--r--extra/docker/mariadb/conf3/my.cnf193
-rw-r--r--extra/sql/bulkload/clds-create-db-objects.sql189
-rw-r--r--extra/sql/bulkload/clds-stored-procedures.sql431
-rw-r--r--extra/sql/drop/clds-drop-db-objects.sql32
-rwxr-xr-xextra/sql/load-sql-files-tests-automation.sh28
9 files changed, 1283 insertions, 0 deletions
diff --git a/extra/docker/clamp/clamp.env b/extra/docker/clamp/clamp.env
new file mode 100644
index 000000000..c38d29b08
--- /dev/null
+++ b/extra/docker/clamp/clamp.env
@@ -0,0 +1 @@
+SPRING_APPLICATION_JSON={"spring": {"datasource": {"url":"jdbc:mysql://db:3306/camundabpm?autoReconnect=true"}, "cldsdatasource": {"url":"jdbc:mysql://db:3306/cldsdb4?autoReconnect=true"}}}
diff --git a/extra/docker/clamp/docker-compose.yml b/extra/docker/clamp/docker-compose.yml
new file mode 100644
index 000000000..a4a935ad3
--- /dev/null
+++ b/extra/docker/clamp/docker-compose.yml
@@ -0,0 +1,22 @@
+version: '2'
+
+services:
+ db:
+ image: mariadb:10.1.11
+ volumes:
+ - "/var/lib/mysql"
+ - "../mariadb/conf1:/etc/mysql/conf.d:ro"
+ - "../../sql/:/docker-entrypoint-initdb.d:ro"
+ environment:
+ - MYSQL_ROOT_PASSWORD=strong_pitchou
+ ports:
+ - "3306:3306"
+
+ clamp:
+ image: onap/clamp
+ depends_on:
+ - db
+ env_file:
+ - clamp.env
+ ports:
+ - "8080:8080"
diff --git a/extra/docker/mariadb/conf1/my.cnf b/extra/docker/mariadb/conf1/my.cnf
new file mode 100644
index 000000000..0be1bd7aa
--- /dev/null
+++ b/extra/docker/mariadb/conf1/my.cnf
@@ -0,0 +1,194 @@
+# Example MySQL config file for medium systems.
+#
+# This is for a system with memory 8G where MySQL plays
+# an important part, or systems up to 128M where MySQL is used together with
+# other programs (such as a web server)
+#
+# In this file, you can use all long options that a program supports.
+# If you want to know which options a program supports, run the program
+# with the "--help" option.
+
+# The following options will be passed to all MySQL clients
+##[client]
+##user = root
+##port = 3306
+##socket = //opt/app/mysql/mysql.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+##performance_schema
+
+slow_query_log =ON
+long_query_time =2
+slow_query_log_file =//var/lib/mysql/slow_query.log
+##basedir = //opt/app/mysql/product/mariadb-10.1.11-linux-x86_64
+##datadir = //opt/app/mysql/data
+##port = 3306
+##socket = //opt/app/mysql/mysql.sock
+skip-external-locking
+explicit_defaults_for_timestamp = true
+skip-symbolic-links
+local-infile = 0
+#ignore_db_dir=lost+found
+key_buffer_size = 16M
+max_allowed_packet = 4M
+table_open_cache = 100
+sort_buffer_size = 512K
+net_buffer_length = 8K
+read_buffer_size = 256K
+read_rnd_buffer_size = 512K
+myisam_sort_buffer_size = 8M
+max_connections = 500
+lower_case_table_names = 1
+thread_stack = 256K
+thread_cache_size = 25
+query_cache_size = 8M
+query_cache_type = 0
+query_prealloc_size = 512K
+query_cache_limit = 1M
+
+# Password validation
+##plugin-load-add=simple_password_check.so
+##simple_password_check_other_characters=0
+
+# Audit Log settings
+plugin-load-add=server_audit.so
+server_audit=FORCE_PLUS_PERMANENT
+server_audit_file_path=//var/lib/mysql/audit.log
+server_audit_file_rotate_size=50M
+server_audit_events=CONNECT,QUERY,TABLE
+server_audit_logging=on
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+#
+#skip-networking
+
+# Replication Master Server (default)
+# binary logging is required for replication
+##log-bin=//var/lib/mysql/mysql-bin
+
+# binary logging format - mixed recommended
+binlog_format=row
+
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+
+# Replication Slave (comment out master section to use this)
+#
+# To configure this host as a replication slave, you can choose between
+# two methods :
+#
+# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
+# the syntax is:
+#
+# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
+# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
+#
+# where you replace <host>, <user>, <password> by quoted strings and
+# <port> by the master's port number (3306 by default).
+#
+# Example:
+#
+# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
+# MASTER_USER='joe', MASTER_PASSWORD='secret';
+#
+# OR
+#
+# 2) Set the variables below. However, in case you choose this method, then
+# start replication for the first time (even unsuccessfully, for example
+# if you mistyped the password in master-password and the slave fails to
+# connect), the slave will create a master.info file, and any later
+# change in this file to the variables' values below will be ignored and
+# overridden by the content of the master.info file, unless you shutdown
+# the slave server, delete master.info and restart the slaver server.
+# For that reason, you may want to leave the lines below untouched
+# (commented) and instead use CHANGE MASTER TO (see above)
+#
+# required unique id between 2 and 2^32 - 1
+# (and different from the master)
+# defaults to 2 if master-host is set
+# but will not function as a slave if omitted
+#server-id = 2
+#
+# The replication master for this slave - required
+#master-host = <hostname>
+#
+# The username the slave will use for authentication when connecting
+# to the master - required
+#master-user = <username>
+#
+# The password the slave will authenticate with when connecting to
+# the master - required
+#master-password = <password>
+#
+# The port the master is listening on.
+# optional - defaults to 3306
+#master-port = <port>
+#
+# binary logging - not required for slaves, but recommended
+#log-bin=mysql-bin
+
+# Uncomment the following if you are using InnoDB tables
+##innodb_data_home_dir = //opt/app/mysql/data
+##innodb_data_file_path = ibdata1:20M:autoextend:max:32G
+##innodb_log_group_home_dir = //opt/app/mysql/iblogs
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+innodb_buffer_pool_size = 6380M
+#innodb_additional_mem_pool_size = 2M
+# Set .._log_file_size to 25 % of buffer pool size
+innodb_log_file_size = 150M
+innodb_log_files_in_group = 3
+innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+innodb_lock_wait_timeout = 50
+innodb_autoextend_increment = 100
+expire_logs_days = 8
+open_files_limit = 2000
+transaction-isolation=READ-COMMITTED
+####### Galera parameters #######
+## Galera Provider configuration
+wsrep_provider=/usr/lib/galera/libgalera_smm.so
+wsrep_provider_options="gcache.size=2G; gcache.page_size=1G"
+## Galera Cluster configuration
+wsrep_cluster_name="MSO-automated-tests-cluster"
+wsrep_cluster_address="gcomm://"
+#wsrep_cluster_address="gcomm://mariadb1,mariadb2,mariadb3"
+##wsrep_cluster_address="gcomm://192.169.3.184,192.169.3.185,192.169.3.186"
+## Galera Synchronization configuration
+wsrep_sst_method=rsync
+#wsrep_sst_method=xtrabackup-v2
+#wsrep_sst_auth="sstuser:Mon#2o!6"
+## Galera Node configuration
+wsrep_node_name="mariadb1"
+##wsrep_node_address="192.169.3.184"
+wsrep_on=ON
+## Status notification
+#wsrep_notify_cmd=/opt/app/mysql/bin/wsrep_notify
+#######
+
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+no-auto-rehash
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
+
+[myisamchk]
+key_buffer_size = 20971520
+
+##[mysqlhotcopy]
+##interactive-timeout
+##[mysqld_safe]
+##malloc-lib=//opt/app/mysql/local/lib/libjemalloc.so.1
+##log-error=//opt/app/mysql/log/mysqld.log \ No newline at end of file
diff --git a/extra/docker/mariadb/conf2/my.cnf b/extra/docker/mariadb/conf2/my.cnf
new file mode 100644
index 000000000..bf5f9c177
--- /dev/null
+++ b/extra/docker/mariadb/conf2/my.cnf
@@ -0,0 +1,193 @@
+# Example MySQL config file for medium systems.
+#
+# This is for a system with memory 8G where MySQL plays
+# an important part, or systems up to 128M where MySQL is used together with
+# other programs (such as a web server)
+#
+# In this file, you can use all long options that a program supports.
+# If you want to know which options a program supports, run the program
+# with the "--help" option.
+
+# The following options will be passed to all MySQL clients
+##[client]
+##user = root
+##port = 3306
+##socket = //opt/app/mysql/mysql.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+##performance_schema
+
+slow_query_log =ON
+long_query_time =2
+slow_query_log_file =//var/lib/mysql/slow_query.log
+##basedir = //opt/app/mysql/product/mariadb-10.1.11-linux-x86_64
+##datadir = //opt/app/mysql/data
+##port = 3306
+##socket = //opt/app/mysql/mysql.sock
+skip-external-locking
+explicit_defaults_for_timestamp = true
+skip-symbolic-links
+local-infile = 0
+#ignore_db_dir=lost+found
+key_buffer_size = 16M
+max_allowed_packet = 4M
+table_open_cache = 100
+sort_buffer_size = 512K
+net_buffer_length = 8K
+read_buffer_size = 256K
+read_rnd_buffer_size = 512K
+myisam_sort_buffer_size = 8M
+max_connections = 500
+lower_case_table_names = 1
+thread_stack = 256K
+thread_cache_size = 25
+query_cache_size = 8M
+query_cache_type = 0
+query_prealloc_size = 512K
+query_cache_limit = 1M
+
+# Password validation
+##plugin-load-add=simple_password_check.so
+##simple_password_check_other_characters=0
+
+# Audit Log settings
+plugin-load-add=server_audit.so
+server_audit=FORCE_PLUS_PERMANENT
+server_audit_file_path=//var/lib/mysql/audit.log
+server_audit_file_rotate_size=50M
+server_audit_events=CONNECT,QUERY,TABLE
+server_audit_logging=on
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+#
+#skip-networking
+
+# Replication Master Server (default)
+# binary logging is required for replication
+##log-bin=//var/lib/mysql/mysql-bin
+
+# binary logging format - mixed recommended
+binlog_format=row
+
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+
+# Replication Slave (comment out master section to use this)
+#
+# To configure this host as a replication slave, you can choose between
+# two methods :
+#
+# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
+# the syntax is:
+#
+# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
+# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
+#
+# where you replace <host>, <user>, <password> by quoted strings and
+# <port> by the master's port number (3306 by default).
+#
+# Example:
+#
+# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
+# MASTER_USER='joe', MASTER_PASSWORD='secret';
+#
+# OR
+#
+# 2) Set the variables below. However, in case you choose this method, then
+# start replication for the first time (even unsuccessfully, for example
+# if you mistyped the password in master-password and the slave fails to
+# connect), the slave will create a master.info file, and any later
+# change in this file to the variables' values below will be ignored and
+# overridden by the content of the master.info file, unless you shutdown
+# the slave server, delete master.info and restart the slaver server.
+# For that reason, you may want to leave the lines below untouched
+# (commented) and instead use CHANGE MASTER TO (see above)
+#
+# required unique id between 2 and 2^32 - 1
+# (and different from the master)
+# defaults to 2 if master-host is set
+# but will not function as a slave if omitted
+#server-id = 2
+#
+# The replication master for this slave - required
+#master-host = <hostname>
+#
+# The username the slave will use for authentication when connecting
+# to the master - required
+#master-user = <username>
+#
+# The password the slave will authenticate with when connecting to
+# the master - required
+#master-password = <password>
+#
+# The port the master is listening on.
+# optional - defaults to 3306
+#master-port = <port>
+#
+# binary logging - not required for slaves, but recommended
+#log-bin=mysql-bin
+
+# Uncomment the following if you are using InnoDB tables
+##innodb_data_home_dir = //opt/app/mysql/data
+##innodb_data_file_path = ibdata1:20M:autoextend:max:32G
+##innodb_log_group_home_dir = //opt/app/mysql/iblogs
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+innodb_buffer_pool_size = 6380M
+#innodb_additional_mem_pool_size = 2M
+# Set .._log_file_size to 25 % of buffer pool size
+innodb_log_file_size = 150M
+innodb_log_files_in_group = 3
+innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+innodb_lock_wait_timeout = 50
+innodb_autoextend_increment = 100
+expire_logs_days = 8
+open_files_limit = 2000
+transaction-isolation=READ-COMMITTED
+####### Galera parameters #######
+## Galera Provider configuration
+wsrep_provider=/usr/lib/galera/libgalera_smm.so
+wsrep_provider_options="gcache.size=2G; gcache.page_size=1G"
+## Galera Cluster configuration
+wsrep_cluster_name="MSO-automated-tests-cluster"
+wsrep_cluster_address="gcomm://mariadb1,mariadb2,mariadb3"
+##wsrep_cluster_address="gcomm://192.169.3.184,192.169.3.185,192.169.3.186"
+## Galera Synchronization configuration
+wsrep_sst_method=rsync
+#wsrep_sst_method=xtrabackup-v2
+#wsrep_sst_auth="sstuser:Mon#2o!6"
+## Galera Node configuration
+wsrep_node_name="mariadb2"
+##wsrep_node_address="192.169.3.184"
+wsrep_on=ON
+## Status notification
+#wsrep_notify_cmd=/opt/app/mysql/bin/wsrep_notify
+#######
+
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+no-auto-rehash
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
+
+[myisamchk]
+key_buffer_size = 20971520
+
+##[mysqlhotcopy]
+##interactive-timeout
+##[mysqld_safe]
+##malloc-lib=//opt/app/mysql/local/lib/libjemalloc.so.1
+##log-error=//opt/app/mysql/log/mysqld.log \ No newline at end of file
diff --git a/extra/docker/mariadb/conf3/my.cnf b/extra/docker/mariadb/conf3/my.cnf
new file mode 100644
index 000000000..74f7a31b0
--- /dev/null
+++ b/extra/docker/mariadb/conf3/my.cnf
@@ -0,0 +1,193 @@
+# Example MySQL config file for medium systems.
+#
+# This is for a system with memory 8G where MySQL plays
+# an important part, or systems up to 128M where MySQL is used together with
+# other programs (such as a web server)
+#
+# In this file, you can use all long options that a program supports.
+# If you want to know which options a program supports, run the program
+# with the "--help" option.
+
+# The following options will be passed to all MySQL clients
+##[client]
+##user = root
+##port = 3306
+##socket = //opt/app/mysql/mysql.sock
+
+# Here follows entries for some specific programs
+
+# The MySQL server
+[mysqld]
+##performance_schema
+
+slow_query_log =ON
+long_query_time =2
+slow_query_log_file =//var/lib/mysql/slow_query.log
+##basedir = //opt/app/mysql/product/mariadb-10.1.11-linux-x86_64
+##datadir = //opt/app/mysql/data
+##port = 3306
+##socket = //opt/app/mysql/mysql.sock
+skip-external-locking
+explicit_defaults_for_timestamp = true
+skip-symbolic-links
+local-infile = 0
+#ignore_db_dir=lost+found
+key_buffer_size = 16M
+max_allowed_packet = 4M
+table_open_cache = 100
+sort_buffer_size = 512K
+net_buffer_length = 8K
+read_buffer_size = 256K
+read_rnd_buffer_size = 512K
+myisam_sort_buffer_size = 8M
+max_connections = 500
+lower_case_table_names = 1
+thread_stack = 256K
+thread_cache_size = 25
+query_cache_size = 8M
+query_cache_type = 0
+query_prealloc_size = 512K
+query_cache_limit = 1M
+
+# Password validation
+##plugin-load-add=simple_password_check.so
+##simple_password_check_other_characters=0
+
+# Audit Log settings
+plugin-load-add=server_audit.so
+server_audit=FORCE_PLUS_PERMANENT
+server_audit_file_path=//var/lib/mysql/audit.log
+server_audit_file_rotate_size=50M
+server_audit_events=CONNECT,QUERY,TABLE
+server_audit_logging=on
+
+# Don't listen on a TCP/IP port at all. This can be a security enhancement,
+# if all processes that need to connect to mysqld run on the same host.
+# All interaction with mysqld must be made via Unix sockets or named pipes.
+# Note that using this option without enabling named pipes on Windows
+# (via the "enable-named-pipe" option) will render mysqld useless!
+#
+#skip-networking
+
+# Replication Master Server (default)
+# binary logging is required for replication
+##log-bin=//var/lib/mysql/mysql-bin
+
+# binary logging format - mixed recommended
+binlog_format=row
+
+# required unique id between 1 and 2^32 - 1
+# defaults to 1 if master-host is not set
+# but will not function as a master if omitted
+
+# Replication Slave (comment out master section to use this)
+#
+# To configure this host as a replication slave, you can choose between
+# two methods :
+#
+# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
+# the syntax is:
+#
+# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
+# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
+#
+# where you replace <host>, <user>, <password> by quoted strings and
+# <port> by the master's port number (3306 by default).
+#
+# Example:
+#
+# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
+# MASTER_USER='joe', MASTER_PASSWORD='secret';
+#
+# OR
+#
+# 2) Set the variables below. However, in case you choose this method, then
+# start replication for the first time (even unsuccessfully, for example
+# if you mistyped the password in master-password and the slave fails to
+# connect), the slave will create a master.info file, and any later
+# change in this file to the variables' values below will be ignored and
+# overridden by the content of the master.info file, unless you shutdown
+# the slave server, delete master.info and restart the slaver server.
+# For that reason, you may want to leave the lines below untouched
+# (commented) and instead use CHANGE MASTER TO (see above)
+#
+# required unique id between 2 and 2^32 - 1
+# (and different from the master)
+# defaults to 2 if master-host is set
+# but will not function as a slave if omitted
+#server-id = 2
+#
+# The replication master for this slave - required
+#master-host = <hostname>
+#
+# The username the slave will use for authentication when connecting
+# to the master - required
+#master-user = <username>
+#
+# The password the slave will authenticate with when connecting to
+# the master - required
+#master-password = <password>
+#
+# The port the master is listening on.
+# optional - defaults to 3306
+#master-port = <port>
+#
+# binary logging - not required for slaves, but recommended
+#log-bin=mysql-bin
+
+# Uncomment the following if you are using InnoDB tables
+##innodb_data_home_dir = //opt/app/mysql/data
+##innodb_data_file_path = ibdata1:20M:autoextend:max:32G
+##innodb_log_group_home_dir = //opt/app/mysql/iblogs
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+innodb_buffer_pool_size = 6380M
+#innodb_additional_mem_pool_size = 2M
+# Set .._log_file_size to 25 % of buffer pool size
+innodb_log_file_size = 150M
+innodb_log_files_in_group = 3
+innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+innodb_lock_wait_timeout = 50
+innodb_autoextend_increment = 100
+expire_logs_days = 8
+open_files_limit = 2000
+transaction-isolation=READ-COMMITTED
+####### Galera parameters #######
+## Galera Provider configuration
+wsrep_provider=/usr/lib/galera/libgalera_smm.so
+wsrep_provider_options="gcache.size=2G; gcache.page_size=1G"
+## Galera Cluster configuration
+wsrep_cluster_name="MSO-automated-tests-cluster"
+wsrep_cluster_address="gcomm://mariadb1,mariadb2,mariadb3"
+##wsrep_cluster_address="gcomm://192.169.3.184,192.169.3.185,192.169.3.186"
+## Galera Synchronization configuration
+wsrep_sst_method=rsync
+#wsrep_sst_method=xtrabackup-v2
+#wsrep_sst_auth="sstuser:Mon#2o!6"
+## Galera Node configuration
+wsrep_node_name="mariadb3"
+##wsrep_node_address="192.169.3.184"
+wsrep_on=ON
+## Status notification
+#wsrep_notify_cmd=/opt/app/mysql/bin/wsrep_notify
+#######
+
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+no-auto-rehash
+# Remove the next comment character if you are not familiar with SQL
+#safe-updates
+
+[myisamchk]
+key_buffer_size = 20971520
+
+##[mysqlhotcopy]
+##interactive-timeout
+##[mysqld_safe]
+##malloc-lib=//opt/app/mysql/local/lib/libjemalloc.so.1
+##log-error=//opt/app/mysql/log/mysqld.log \ No newline at end of file
diff --git a/extra/sql/bulkload/clds-create-db-objects.sql b/extra/sql/bulkload/clds-create-db-objects.sql
new file mode 100644
index 000000000..5cbb7e017
--- /dev/null
+++ b/extra/sql/bulkload/clds-create-db-objects.sql
@@ -0,0 +1,189 @@
+#
+# Create CLDS database objects (tables, etc.)
+#
+#
+CREATE DATABASE `camundabpm`;
+USE `camundabpm`;
+DROP USER 'camunda';
+CREATE USER 'camunda';
+GRANT ALL on camundabpm.* to 'camunda' identified by 'ndMSpw4CAM' with GRANT OPTION;
+FLUSH PRIVILEGES;
+
+CREATE DATABASE `cldsdb4`;
+USE `cldsdb4`;
+DROP USER 'clds';
+CREATE USER 'clds';
+GRANT ALL on cldsdb4.* to 'clds' identified by 'sidnnd83K' with GRANT OPTION;
+GRANT SELECT on mysql.proc TO 'clds';
+FLUSH PRIVILEGES;
+
+
+CREATE TABLE template (
+ template_id VARCHAR(36) NOT NULL,
+ template_name VARCHAR(80) NOT NULL,
+ template_bpmn_id VARCHAR(36) NULL,
+ template_image_id VARCHAR(36) NULL,
+ template_doc_id VARCHAR(36) NULL,
+ PRIMARY KEY (template_id),
+ UNIQUE (template_name)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE template_bpmn (
+ template_bpmn_id VARCHAR(36) NOT NULL,
+ template_id VARCHAR(36) NOT NULL,
+ template_bpmn_text MEDIUMTEXT NOT NULL,
+ userid VARCHAR(8),
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (template_bpmn_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE template_image (
+ template_image_id VARCHAR(36) NOT NULL,
+ template_id VARCHAR(36) NOT NULL,
+ template_image_text MEDIUMTEXT NULL,
+ userid VARCHAR(8),
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (template_image_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE template_doc (
+ template_doc_id VARCHAR(36) NOT NULL,
+ template_id VARCHAR(36) NOT NULL,
+ template_doc_text MEDIUMTEXT NULL,
+ userid VARCHAR(8),
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (template_doc_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE model (
+ model_id VARCHAR(36) NOT NULL,
+ model_name VARCHAR(80) NOT NULL,
+ template_id VARCHAR(36) NULL,
+ model_prop_id VARCHAR(36) NULL,
+ model_blueprint_id VARCHAR(36) NULL,
+ event_id VARCHAR(36) NULL,
+ control_name_prefix VARCHAR(80) NULL,
+ control_name_uuid VARCHAR(36) NOT NULL,
+ PRIMARY KEY (model_id),
+ UNIQUE (model_name),
+ UNIQUE (control_name_uuid)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE model_properties (
+ model_prop_id VARCHAR(36) NOT NULL,
+ model_id VARCHAR(36) NOT NULL,
+ model_prop_text MEDIUMTEXT NULL,
+ userid VARCHAR(8),
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (model_prop_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE model_blueprint (
+ model_blueprint_id VARCHAR(36) NOT NULL,
+ model_id VARCHAR(36) NOT NULL,
+ model_blueprint_text MEDIUMTEXT NULL,
+ userid VARCHAR(8),
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (model_blueprint_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE model_instance (
+ model_instance_id VARCHAR(36) NOT NULL,
+ model_id VARCHAR(36) NOT NULL,
+ vm_name VARCHAR(250) NOT NULL,
+ location VARCHAR(250) NULL,
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ PRIMARY KEY (model_instance_id),
+ UNIQUE (model_id, vm_name)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE event (
+ event_id VARCHAR(36) NOT NULL,
+ model_id VARCHAR(36) NULL,
+ action_cd VARCHAR(80) NOT NULL,
+ action_state_cd VARCHAR(80) NULL,
+ prev_event_id VARCHAR(36) NULL,
+ process_instance_id VARCHAR(80) NULL,
+ userid VARCHAR(8) NULL,
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (event_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+CREATE TABLE clds_service_cache (
+ invariant_service_id VARCHAR(36) NOT NULL,
+ service_id VARCHAR(36) NULL,
+ timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ object_data MEDIUMBLOB NULL,
+ PRIMARY KEY (invariant_service_id)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+ALTER TABLE template
+ ADD CONSTRAINT template_bpmn_id_fkey01
+ FOREIGN KEY (template_bpmn_id)
+ REFERENCES template_bpmn (template_bpmn_id);
+
+ALTER TABLE template
+ ADD CONSTRAINT template_image_id_fkey01
+ FOREIGN KEY (template_image_id)
+ REFERENCES template_image (template_image_id);
+
+ALTER TABLE template
+ ADD CONSTRAINT template_doc_id_fkey01
+ FOREIGN KEY (template_doc_id)
+ REFERENCES template_doc (template_doc_id);
+
+ALTER TABLE template_bpmn
+ ADD CONSTRAINT template_id_fkey02
+ FOREIGN KEY (template_id)
+ REFERENCES template (template_id);
+
+ALTER TABLE template_image
+ ADD CONSTRAINT template_id_fkey03
+ FOREIGN KEY (template_id)
+ REFERENCES template (template_id);
+
+ALTER TABLE template_doc
+ ADD CONSTRAINT template_id_fkey04
+ FOREIGN KEY (template_id)
+ REFERENCES template (template_id);
+
+ALTER TABLE model
+ ADD CONSTRAINT template_id_fkey01
+ FOREIGN KEY (template_id)
+ REFERENCES template (template_id);
+
+ALTER TABLE model
+ ADD CONSTRAINT model_prop_id_fkey01
+ FOREIGN KEY (model_prop_id)
+ REFERENCES model_properties (model_prop_id);
+
+ALTER TABLE model
+ ADD CONSTRAINT model_blueprint_id_fkey01
+ FOREIGN KEY (model_blueprint_id)
+ REFERENCES model_blueprint (model_blueprint_id);
+
+ALTER TABLE model
+ ADD CONSTRAINT event_id_fkey01
+ FOREIGN KEY (event_id)
+ REFERENCES event (event_id);
+
+ALTER TABLE model_properties
+ ADD CONSTRAINT model_id_fkey01
+ FOREIGN KEY (model_id)
+ REFERENCES model (model_id);
+
+ALTER TABLE model_blueprint
+ ADD CONSTRAINT model_id_fkey02
+ FOREIGN KEY (model_id)
+ REFERENCES model (model_id);
+
+ALTER TABLE model_instance
+ ADD CONSTRAINT model_id_fkey04
+ FOREIGN KEY (model_id)
+ REFERENCES model (model_id);
+
+ALTER TABLE event
+ ADD CONSTRAINT model_id_fkey03
+ FOREIGN KEY (model_id)
+ REFERENCES model (model_id);
+
diff --git a/extra/sql/bulkload/clds-stored-procedures.sql b/extra/sql/bulkload/clds-stored-procedures.sql
new file mode 100644
index 000000000..41cc75e12
--- /dev/null
+++ b/extra/sql/bulkload/clds-stored-procedures.sql
@@ -0,0 +1,431 @@
+#
+# CLDS stored procedures
+#
+#
+USE cldsdb4;
+
+DROP PROCEDURE IF EXISTS upd_event;
+DROP PROCEDURE IF EXISTS ins_event;
+DROP PROCEDURE IF EXISTS del_all_model_instances;
+DROP PROCEDURE IF EXISTS del_model_instance;
+DROP PROCEDURE IF EXISTS ins_model_instance;
+DROP PROCEDURE IF EXISTS set_model;
+DROP PROCEDURE IF EXISTS get_model;
+DROP PROCEDURE IF EXISTS get_model_template;
+DROP PROCEDURE IF EXISTS set_template;
+DROP PROCEDURE IF EXISTS get_template;
+DELIMITER //
+CREATE PROCEDURE get_template
+ (IN v_template_name VARCHAR(80),
+ OUT v_template_id VARCHAR(36),
+ OUT v_template_bpmn_id VARCHAR(36),
+ OUT v_template_bpmn_userid VARCHAR(8),
+ OUT v_template_bpmn_text MEDIUMTEXT,
+ OUT v_template_image_id VARCHAR(36),
+ OUT v_template_image_userid VARCHAR(8),
+ OUT v_template_image_text MEDIUMTEXT,
+ OUT v_template_doc_id VARCHAR(36),
+ OUT v_template_doc_userid VARCHAR(8),
+ OUT v_template_doc_text MEDIUMTEXT)
+BEGIN
+ SELECT t.template_id,
+ tb.template_bpmn_id,
+ tb.userid,
+ tb.template_bpmn_text,
+ ti.template_image_id,
+ ti.userid,
+ ti.template_image_text,
+ td.template_doc_id,
+ td.userid,
+ td.template_doc_text
+ INTO v_template_id,
+ v_template_bpmn_id,
+ v_template_bpmn_userid,
+ v_template_bpmn_text,
+ v_template_image_id,
+ v_template_image_userid,
+ v_template_image_text,
+ v_template_doc_id,
+ v_template_doc_userid,
+ v_template_doc_text
+ FROM template t,
+ template_bpmn tb,
+ template_image ti,
+ template_doc td
+ WHERE t.template_bpmn_id = tb.template_bpmn_id
+ AND t.template_image_id = ti.template_image_id
+ AND t.template_doc_id = td.template_doc_id
+ AND t.template_name = v_template_name;
+END;
+CREATE PROCEDURE set_template
+ (IN v_template_name VARCHAR(80),
+ IN v_userid VARCHAR(8),
+ IN v_template_bpmn_text MEDIUMTEXT,
+ IN v_template_image_text MEDIUMTEXT,
+ IN v_template_doc_text MEDIUMTEXT,
+ OUT v_template_id VARCHAR(36),
+ OUT v_template_bpmn_id VARCHAR(36),
+ OUT v_template_bpmn_userid VARCHAR(8),
+ OUT v_template_image_id VARCHAR(36),
+ OUT v_template_image_userid VARCHAR(8),
+ OUT v_template_doc_id VARCHAR(36),
+ OUT v_template_doc_userid VARCHAR(8))
+BEGIN
+ DECLARE v_old_template_bpmn_text MEDIUMTEXT;
+ DECLARE v_old_template_image_text MEDIUMTEXT;
+ DECLARE v_old_template_doc_text MEDIUMTEXT;
+ SET v_template_id = NULL;
+ CALL get_template(
+ v_template_name,
+ v_template_id,
+ v_template_bpmn_id,
+ v_template_bpmn_userid,
+ v_old_template_bpmn_text,
+ v_template_image_id,
+ v_template_image_userid,
+ v_old_template_image_text,
+ v_template_doc_id,
+ v_template_doc_userid,
+ v_old_template_doc_text);
+ IF v_template_id IS NULL THEN
+ BEGIN
+ SET v_template_id = UUID();
+ INSERT INTO template
+ (template_id, template_name)
+ VALUES (v_template_id, v_template_name);
+ END;
+ END IF;
+ IF v_template_bpmn_id IS NULL OR v_template_bpmn_text <> v_old_template_bpmn_text THEN
+ SET v_template_bpmn_id = UUID();
+ INSERT INTO template_bpmn
+ (template_bpmn_id, template_id, template_bpmn_text, userid)
+ VALUES (v_template_bpmn_id, v_template_id, v_template_bpmn_text, v_userid);
+ SET v_template_bpmn_userid = v_userid;
+ END IF;
+ IF v_template_image_id IS NULL OR v_template_image_text <> v_old_template_image_text THEN
+ SET v_template_image_id = UUID();
+ INSERT INTO template_image
+ (template_image_id, template_id, template_image_text, userid)
+ VALUES (v_template_image_id, v_template_id, v_template_image_text, v_userid);
+ SET v_template_image_userid = v_userid;
+ END IF;
+ IF v_template_doc_id IS NULL OR v_template_doc_text <> v_old_template_doc_text THEN
+ SET v_template_doc_id = UUID();
+ INSERT INTO template_doc
+ (template_doc_id, template_id, template_doc_text, userid)
+ VALUES (v_template_doc_id, v_template_id, v_template_doc_text, v_userid);
+ SET v_template_doc_userid = v_userid;
+ END IF;
+ UPDATE template
+ SET template_bpmn_id = v_template_bpmn_id,
+ template_image_id = v_template_image_id,
+ template_doc_id = v_template_doc_id
+ WHERE template_id = v_template_id;
+END;
+CREATE PROCEDURE get_model
+ (IN v_model_name VARCHAR(80),
+ OUT v_control_name_prefix VARCHAR(80),
+ INOUT v_control_name_uuid VARCHAR(36),
+ OUT v_model_id VARCHAR(36),
+ OUT v_template_name VARCHAR(80),
+ OUT v_template_id VARCHAR(36),
+ OUT v_model_prop_id VARCHAR(36),
+ OUT v_model_prop_userid VARCHAR(8),
+ OUT v_model_prop_text MEDIUMTEXT,
+ OUT v_model_blueprint_id VARCHAR(36),
+ OUT v_model_blueprint_userid VARCHAR(8),
+ OUT v_model_blueprint_text MEDIUMTEXT,
+ OUT v_event_id VARCHAR(36),
+ OUT v_action_cd VARCHAR(80),
+ OUT v_action_state_cd VARCHAR(80),
+ OUT v_event_process_instance_id VARCHAR(80),
+ OUT v_event_userid VARCHAR(8))
+BEGIN
+ SELECT m.control_name_prefix,
+ m.control_name_uuid,
+ m.model_id,
+ t.template_name,
+ m.template_id,
+ mp.model_prop_id,
+ mp.userid,
+ mp.model_prop_text,
+ mb.model_blueprint_id,
+ mb.userid,
+ mb.model_blueprint_text,
+ e.event_id,
+ e.action_cd,
+ e.action_state_cd,
+ e.process_instance_id,
+ e.userid
+ INTO v_control_name_prefix,
+ v_control_name_uuid,
+ v_model_id,
+ v_template_name,
+ v_template_id,
+ v_model_prop_id,
+ v_model_prop_userid,
+ v_model_prop_text,
+ v_model_blueprint_id,
+ v_model_blueprint_userid,
+ v_model_blueprint_text,
+ v_event_id,
+ v_action_cd,
+ v_action_state_cd,
+ v_event_process_instance_id,
+ v_event_userid
+ FROM model m,
+ template t,
+ model_properties mp,
+ model_blueprint mb,
+ event e
+ WHERE m.template_id = t.template_id
+ AND m.model_prop_id = mp.model_prop_id
+ AND m.model_blueprint_id = mb.model_blueprint_id
+ AND m.event_id = e.event_id
+ AND (m.model_name = v_model_name
+ OR m.control_name_uuid = v_control_name_uuid);
+ SELECT model_instance_id,
+ vm_name,
+ location,
+ timestamp
+ FROM model_instance
+ WHERE model_id = v_model_id
+ ORDER BY 2;
+END;
+CREATE PROCEDURE get_model_template
+ (IN v_model_name VARCHAR(80),
+ OUT v_control_name_prefix VARCHAR(80),
+ INOUT v_control_name_uuid VARCHAR(36),
+ OUT v_model_id VARCHAR(36),
+ OUT v_template_name VARCHAR(80),
+ OUT v_template_id VARCHAR(36),
+ OUT v_model_prop_id VARCHAR(36),
+ OUT v_model_prop_userid VARCHAR(8),
+ OUT v_model_prop_text MEDIUMTEXT,
+ OUT v_model_blueprint_id VARCHAR(36),
+ OUT v_model_blueprint_userid VARCHAR(8),
+ OUT v_model_blueprint_text MEDIUMTEXT,
+ OUT v_template_bpmn_id VARCHAR(36),
+ OUT v_template_bpmn_userid VARCHAR(8),
+ OUT v_template_bpmn_text MEDIUMTEXT,
+ OUT v_template_image_id VARCHAR(36),
+ OUT v_template_image_userid VARCHAR(8),
+ OUT v_template_image_text MEDIUMTEXT,
+ OUT v_template_doc_id VARCHAR(36),
+ OUT v_template_doc_userid VARCHAR(8),
+ OUT v_template_doc_text MEDIUMTEXT,
+ OUT v_event_id VARCHAR(36),
+ OUT v_action_cd VARCHAR(80),
+ OUT v_action_state_cd VARCHAR(80),
+ OUT v_event_process_instance_id VARCHAR(80),
+ OUT v_event_userid VARCHAR(8))
+BEGIN
+ CALL get_model(
+ v_model_name,
+ v_control_name_prefix,
+ v_control_name_uuid,
+ v_model_id,
+ v_template_name,
+ v_template_id,
+ v_model_prop_id,
+ v_model_prop_userid,
+ v_model_prop_text,
+ v_model_blueprint_id,
+ v_model_blueprint_userid,
+ v_model_blueprint_text,
+ v_event_id,
+ v_action_cd,
+ v_action_state_cd,
+ v_event_process_instance_id,
+ v_event_userid);
+ CALL get_template(
+ v_template_name,
+ v_template_id,
+ v_template_bpmn_id,
+ v_template_bpmn_userid,
+ v_template_bpmn_text,
+ v_template_image_id,
+ v_template_image_userid,
+ v_template_image_text,
+ v_template_doc_id,
+ v_template_doc_userid,
+ v_template_doc_text);
+ END;
+CREATE PROCEDURE set_model
+ (IN v_model_name VARCHAR(80),
+ IN v_template_id VARCHAR(36),
+ IN v_userid VARCHAR(8),
+ IN v_model_prop_text MEDIUMTEXT,
+ IN v_model_blueprint_text MEDIUMTEXT,
+ INOUT v_control_name_prefix VARCHAR(80),
+ INOUT v_control_name_uuid VARCHAR(36),
+ OUT v_model_id VARCHAR(36),
+ OUT v_model_prop_id VARCHAR(36),
+ OUT v_model_prop_userid VARCHAR(8),
+ OUT v_model_blueprint_id VARCHAR(36),
+ OUT v_model_blueprint_userid VARCHAR(8),
+ OUT v_event_id VARCHAR(36),
+ OUT v_action_cd VARCHAR(80),
+ OUT v_action_state_cd VARCHAR(80),
+ OUT v_event_process_instance_id VARCHAR(80),
+ OUT v_event_userid VARCHAR(8))
+BEGIN
+ DECLARE v_old_template_name VARCHAR(80);
+ DECLARE v_old_template_id VARCHAR(36);
+ DECLARE v_old_control_name_prefix VARCHAR(80);
+ DECLARE v_old_control_name_uuid VARCHAR(36);
+ DECLARE v_old_model_prop_text MEDIUMTEXT;
+ DECLARE v_old_model_blueprint_text MEDIUMTEXT;
+ SET v_model_id = NULL;
+ CALL get_model(
+ v_model_name,
+ v_old_control_name_prefix,
+ v_old_control_name_uuid,
+ v_model_id,
+ v_old_template_name,
+ v_old_template_id,
+ v_model_prop_id,
+ v_model_prop_userid,
+ v_old_model_prop_text,
+ v_model_blueprint_id,
+ v_model_blueprint_userid,
+ v_old_model_blueprint_text,
+ v_event_id,
+ v_action_cd,
+ v_action_state_cd,
+ v_event_process_instance_id,
+ v_event_userid);
+ IF v_model_id IS NULL THEN
+ BEGIN
+ # UUID can be provided initially but cannot be updated
+ # if not provided (this is expected) then it will be set here
+ IF v_control_name_uuid IS NULL THEN
+ SET v_control_name_uuid = UUID();
+ END IF;
+ SET v_model_id = v_control_name_uuid;
+ INSERT INTO model
+ (model_id, model_name, template_id, control_name_prefix, control_name_uuid)
+ VALUES (v_model_id, v_model_name, v_template_id, v_control_name_prefix, v_control_name_uuid);
+ # since just created model, insert CREATED event as initial default event
+ SET v_action_cd = 'CREATE';
+ SET v_action_state_cd = 'COMPLETED';
+ SET v_event_userid = v_userid;
+ SET v_event_id = UUID();
+ INSERT INTO event
+ (event_id, model_id, action_cd, action_state_cd, userid)
+ VALUES (v_event_id, v_model_id, v_action_cd, v_action_state_cd, v_event_userid);
+ UPDATE model
+ SET event_id = v_event_id
+ WHERE model_id = v_model_id;
+ END;
+ ELSE
+ BEGIN
+ # use old control_name_prefix if null value is provided
+ IF v_control_name_prefix IS NULL THEN
+ SET v_control_name_prefix = v_old_control_name_prefix;
+ END IF;
+ # UUID can not be updated after initial insert
+ SET v_control_name_uuid = v_old_control_name_uuid;
+ END;
+ END IF;
+ IF v_model_prop_id IS NULL OR v_model_prop_text <> v_old_model_prop_text THEN
+ SET v_model_prop_id = UUID();
+ INSERT INTO model_properties
+ (model_prop_id, model_id, model_prop_text, userid)
+ VALUES (v_model_prop_id, v_model_id, v_model_prop_text, v_userid);
+ SET v_model_prop_userid = v_userid;
+ END IF;
+ IF v_model_blueprint_id IS NULL OR v_model_blueprint_text <> v_old_model_blueprint_text THEN
+ SET v_model_blueprint_id = UUID();
+ INSERT INTO model_blueprint
+ (model_blueprint_id, model_id, model_blueprint_text, userid)
+ VALUES (v_model_blueprint_id, v_model_id, v_model_blueprint_text, v_userid);
+ SET v_model_blueprint_userid = v_userid;
+ END IF;
+ UPDATE model
+ SET control_name_prefix = v_control_name_prefix,
+ model_prop_id = v_model_prop_id,
+ model_blueprint_id = v_model_blueprint_id
+ WHERE model_id = v_model_id;
+END;
+CREATE PROCEDURE ins_model_instance
+ (IN v_control_name_uuid VARCHAR(36),
+ IN v_vm_name VARCHAR(250),
+ IN v_location VARCHAR(250),
+ OUT v_model_id VARCHAR(36),
+ OUT v_model_instance_id VARCHAR(36))
+BEGIN
+ SELECT m.model_id
+ INTO v_model_id
+ FROM model m
+ WHERE m.control_name_uuid = v_control_name_uuid;
+ SET v_model_instance_id = UUID();
+ INSERT INTO model_instance
+ (model_instance_id, model_id, vm_name, location)
+ VALUES (v_model_instance_id, v_model_id, v_vm_name, v_location);
+END;
+CREATE PROCEDURE del_model_instance
+ (IN v_control_name_uuid VARCHAR(36),
+ IN v_vm_name VARCHAR(250),
+ OUT v_model_id VARCHAR(36),
+ OUT v_model_instance_id VARCHAR(36))
+BEGIN
+ SELECT m.model_id, i.model_instance_id
+ INTO v_model_id,
+ v_model_instance_id
+ FROM model m,
+ model_instance i
+ WHERE m.model_id = i.model_id
+ AND m.control_name_uuid = v_control_name_uuid
+ AND i.vm_name = v_vm_name;
+ DELETE FROM model_instance
+ WHERE model_instance_id = v_model_instance_id;
+END;
+CREATE PROCEDURE del_all_model_instances
+ (IN v_control_name_uuid VARCHAR(36),
+ OUT v_model_id VARCHAR(36))
+BEGIN
+ SELECT m.model_id
+ INTO v_model_id
+ FROM model m
+ WHERE m.control_name_uuid = v_control_name_uuid;
+ DELETE FROM model_instance
+ WHERE model_id = v_model_id;
+END;
+CREATE PROCEDURE ins_event
+ (IN v_model_name VARCHAR(80),
+ IN v_control_name_prefix VARCHAR(80),
+ IN v_control_name_uuid VARCHAR(36),
+ IN v_userid VARCHAR(8),
+ IN v_action_cd VARCHAR(80),
+ IN v_action_state_cd VARCHAR(80),
+ IN v_process_instance_id VARCHAR(80),
+ OUT v_model_id VARCHAR(36),
+ OUT v_event_id VARCHAR(36))
+BEGIN
+ DECLARE v_prev_event_id VARCHAR(36);
+ SELECT m.model_id,
+ m.event_id
+ INTO v_model_id,
+ v_prev_event_id
+ FROM model m
+ WHERE m.model_name = v_model_name
+ OR m.control_name_uuid = v_control_name_uuid;
+ SET v_event_id = UUID();
+ INSERT INTO event
+ (event_id, model_id, action_cd, action_state_cd, prev_event_id, process_instance_id, userid)
+ VALUES (v_event_id, v_model_id, v_action_cd, v_action_state_cd, v_prev_event_id, v_process_instance_id, v_userid);
+ UPDATE model
+ SET event_id = v_event_id
+ WHERE model_id = v_model_id;
+END;
+CREATE PROCEDURE upd_event
+ (IN v_event_id VARCHAR(36),
+ IN v_process_instance_id VARCHAR(80))
+BEGIN
+ UPDATE event
+ SET process_instance_id = v_process_instance_id
+ WHERE event_id = v_event_id;
+END
+//
+DELIMITER ;
diff --git a/extra/sql/drop/clds-drop-db-objects.sql b/extra/sql/drop/clds-drop-db-objects.sql
new file mode 100644
index 000000000..487aa49d0
--- /dev/null
+++ b/extra/sql/drop/clds-drop-db-objects.sql
@@ -0,0 +1,32 @@
+#
+# Drop CLDS database objects (tables, etc.)
+#
+#
+
+
+ALTER TABLE template
+ DROP FOREIGN KEY template_image_id_fkey01;
+ALTER TABLE template
+ DROP FOREIGN KEY template_bpmn_id_fkey01;
+ALTER TABLE template
+ DROP FOREIGN KEY template_doc_id_fkey01;
+
+ALTER TABLE model
+ DROP FOREIGN KEY template_id_fkey01;
+ALTER TABLE model
+ DROP FOREIGN KEY model_prop_id_fkey01;
+ALTER TABLE model
+ DROP FOREIGN KEY model_blueprint_id_fkey01;
+ALTER TABLE model
+ DROP FOREIGN KEY event_id_fkey01;
+
+DROP TABLE model_instance;
+DROP TABLE model_blueprint;
+DROP TABLE model_properties;
+DROP TABLE event;
+DROP TABLE model;
+
+DROP TABLE template_doc;
+DROP TABLE template_image;
+DROP TABLE template_bpmn;
+DROP TABLE template;
diff --git a/extra/sql/load-sql-files-tests-automation.sh b/extra/sql/load-sql-files-tests-automation.sh
new file mode 100755
index 000000000..4924922c9
--- /dev/null
+++ b/extra/sql/load-sql-files-tests-automation.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+###
+# ============LICENSE_START=======================================================
+# ONAP CLAMP
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END============================================
+# ===================================================================
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+###
+
+cd /docker-entrypoint-initdb.d/bulkload
+mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < clds-create-db-objects.sql
+mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < clds-stored-procedures.sql