Added UserGroupDao methods and tests.
Change-Id: I71d224c5d236cc57ef74749e06d4b28d0bc2cc6a
diff --git a/full/src/main/resources/db/insert/V3.1__insert_virtual_corpus.sql b/full/src/main/resources/db/insert/V3.1__insert_virtual_corpus.sql
index 442a39c..db77480 100644
--- a/full/src/main/resources/db/insert/V3.1__insert_virtual_corpus.sql
+++ b/full/src/main/resources/db/insert/V3.1__insert_virtual_corpus.sql
@@ -2,16 +2,16 @@
-- user groups
INSERT INTO user_group(name,status,created_by)
- VALUES ("dory group","active","dory");
+ VALUES ("dory group","ACTIVE","dory");
INSERT INTO user_group(name,status,created_by)
- VALUES ("auto group","hidden","system");
+ VALUES ("auto group","HIDDEN","system");
INSERT INTO user_group(name,status,created_by)
- VALUES ("all users","hidden","system");
+ VALUES ("all users","HIDDEN","system");
INSERT INTO user_group(name,status,created_by)
- VALUES ("deleted group","deleted","dory");
+ VALUES ("deleted group","DELETED","dory");
diff --git a/full/src/main/resources/db/insert/V3.3__insert_member_roles.sql b/full/src/main/resources/db/insert/V3.3__insert_member_roles.sql
new file mode 100644
index 0000000..459b5e2
--- /dev/null
+++ b/full/src/main/resources/db/insert/V3.3__insert_member_roles.sql
@@ -0,0 +1,28 @@
+-- member roles
+-- dory group
+INSERT INTO group_member_role(group_member_id,role_id)
+SELECT
+ (SELECT id FROM user_group_member WHERE user_id="dory" AND group_id=1),
+ (SELECT id FROM role WHERE name = "group admin");
+
+INSERT INTO group_member_role(group_member_id,role_id)
+SELECT
+ (SELECT id FROM user_group_member WHERE user_id="dory" AND group_id=1),
+ (SELECT id FROM role WHERE name = "vc admin");
+
+INSERT INTO group_member_role(group_member_id,role_id)
+SELECT
+ (SELECT id FROM user_group_member WHERE user_id="nemo" AND group_id=1),
+ (SELECT id FROM role WHERE name = "group member");
+
+INSERT INTO group_member_role(group_member_id,role_id)
+SELECT
+ (SELECT id FROM user_group_member WHERE user_id="nemo" AND group_id=1),
+ (SELECT id FROM role WHERE name = "vc member");
+
+-- auto group
+INSERT INTO group_member_role(group_member_id,role_id)
+SELECT
+ (SELECT id FROM user_group_member WHERE user_id="pearl" AND group_id=2),
+ (SELECT id FROM role WHERE name = "vc member");
+
diff --git a/full/src/main/resources/db/new-sqlite/V1.1__create_virtual_corpus_tables.sql b/full/src/main/resources/db/new-sqlite/V1.1__create_virtual_corpus_tables.sql
index 27fb035..91b01a7 100644
--- a/full/src/main/resources/db/new-sqlite/V1.1__create_virtual_corpus_tables.sql
+++ b/full/src/main/resources/db/new-sqlite/V1.1__create_virtual_corpus_tables.sql
@@ -21,7 +21,8 @@
id INTEGER PRIMARY KEY AUTOINCREMENT,
name varchar(100) NOT NULL,
status varchar(100) NOT NULL,
- created_by varchar(100) NOT NULL
+ created_by varchar(100) NOT NULL,
+ deleted_by varchar(100) DEFAULT NULL
);
CREATE INDEX user_group_index ON user_group(status);
diff --git a/full/src/main/resources/db/predefined/V3.2__insert_predefined_roles.sql b/full/src/main/resources/db/predefined/V3.2__insert_predefined_roles.sql
index fdb8031..c9409ea 100644
--- a/full/src/main/resources/db/predefined/V3.2__insert_predefined_roles.sql
+++ b/full/src/main/resources/db/predefined/V3.2__insert_predefined_roles.sql
@@ -1,8 +1,8 @@
-- roles
INSERT INTO role(name) VALUES ("group admin");
INSERT INTO role(name) VALUES ("group member");
-INSERT INTO role(name) VALUES ("VC admin");
-INSERT INTO role(name) VALUES ("VC member");
+INSERT INTO role(name) VALUES ("vc admin");
+INSERT INTO role(name) VALUES ("vc member");
-- privileges
INSERT INTO privilege(name,role_id)
diff --git a/full/src/main/resources/jdbc.properties b/full/src/main/resources/jdbc.properties
index 65fba6b..9b888f0 100644
--- a/full/src/main/resources/jdbc.properties
+++ b/full/src/main/resources/jdbc.properties
@@ -9,7 +9,7 @@
#jdbc.password=password
# db.insert contains test data, omit it in production setting
-#jdbc.schemaPath=db.new-mysql, db.insert
+#jdbc.schemaPath=db.new-mysql, db.insert, db.predefined
#-------------------------------------------------------------------------------
@@ -22,4 +22,4 @@
jdbc.username=pc
jdbc.password=pc
# db.insert contains test data, omit it in production setting
-jdbc.schemaPath=db.new-sqlite, db.insert
+jdbc.schemaPath=db.new-sqlite, db.insert, db.predefined