diff --git a/src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java b/src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java index 872f2cb349d40239c9f68cf82682212c5ecbd7da..85a7da7e2a4d2bb7ce2c7a978f61799e53ff1ccd 100644 --- a/src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +++ b/src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java @@ -63,9 +63,9 @@ public class NodeDAO { StringBuilder sb = new StringBuilder(); sb.append("INSERT INTO node"); - sb.append(" (name, busy_state, owner_id, creator_id, group_read, group_write,"); + sb.append(" (name, busy_state, creator_id, group_read, group_write,"); sb.append(" is_public, parent_path, parent_relative_path, type, accept_views, provide_views)"); - sb.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); + sb.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); jdbcTemplate.update(conn -> { PreparedStatement ps = conn.prepareStatement(sb.toString()); @@ -73,7 +73,6 @@ public class NodeDAO { ps.setString(++i, NodeUtils.getNodeName(myNode)); ps.setBoolean(++i, NodeUtils.getIsBusy(myNode)); ps.setString(++i, NodeProperties.getStandardNodePropertyByName(myNode, "creator")); - ps.setString(++i, NodeProperties.getStandardNodePropertyByName(myNode, "creator")); ps.setArray(++i, fromPropertyToArray(ps, NodeProperties.getStandardNodePropertyByName(myNode, "groupread"))); ps.setArray(++i, fromPropertyToArray(ps, NodeProperties.getStandardNodePropertyByName(myNode, "groupwrite"))); ps.setBoolean(++i, Boolean.valueOf(NodeProperties.getStandardNodePropertyByName(myNode, "publicread"))); @@ -240,7 +239,7 @@ public class NodeDAO { String insertSql = "INSERT INTO deleted_node " + "(node_id, parent_path, parent_relative_path, " + "name, os_name, tstamp_wrapper_dir, type, location_id, format, " - + "async_trans, busy_state, owner_id, creator_id, group_read, " + + "async_trans, busy_state, creator_id, group_read, " + "group_write, is_public, delta, content_type, content_encoding, " + "content_length, content_md5, created_on, last_modified, " + "accept_views, provide_views, protocols, sticky)\n"; @@ -253,7 +252,7 @@ public class NodeDAO { + "OR os.vos_path = ?) RETURNING\n" + "n.node_id, parent_path, parent_relative_path, " + "name, os_name, tstamp_wrapper_dir, type, location_id, format, " - + "async_trans, busy_state, owner_id, creator_id, group_read, " + + "async_trans, busy_state, creator_id, group_read, " + "group_write, is_public, delta, content_type, content_encoding, " + "content_length, content_md5, created_on, last_modified, " + "accept_views, provide_views, protocols, sticky\n"; diff --git a/src/test/resources/test-data.sql b/src/test/resources/test-data.sql index 15d968fe837d88add352d84ef0696bc0cd913251..54a4a81a8f63246172aef88b730e9f25b18edc27 100644 --- a/src/test/resources/test-data.sql +++ b/src/test/resources/test-data.sql @@ -1,16 +1,16 @@ DELETE FROM node; ALTER SEQUENCE node_node_id_seq RESTART WITH 1; -INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, location_id, is_public) VALUES (NULL, NULL, '', 'container', '0', '0', 1, true); +INSERT INTO node (parent_path, parent_relative_path, name, type, creator_id, location_id, is_public) VALUES (NULL, NULL, '', 'container', '0', 1, true); -INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, group_read, group_write, location_id) VALUES ('', NULL, 'test1', 'container', 'user1', 'user1', '{"group1","group2"}','{"group2"}', 1); -- /test1 -INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, location_id) VALUES ('2', '', 'f1', 'container', 'user1', 'user1', 1); -- /test1/f1 (rel: /f1) -INSERT INTO node (parent_path, parent_relative_path, name, os_name, type, owner_id, creator_id, location_id) VALUES ('2.3', '3', 'f2_renamed', 'f2', 'container', 'user1', 'user1', 1); -- /test1/f1/f2_renamed (rel: /f1/f2) -INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, location_id) VALUES ('2.3.4', '3.4', 'f3', 'data', 'user1', 'user1', 1); -- /test1/f1/f2_renamed/f3 (rel: /f1/f2/f3) +INSERT INTO node (parent_path, parent_relative_path, name, type, creator_id, group_read, group_write, location_id) VALUES ('', NULL, 'test1', 'container', 'user1', '{"group1","group2"}','{"group2"}', 1); -- /test1 +INSERT INTO node (parent_path, parent_relative_path, name, type, creator_id, location_id) VALUES ('2', '', 'f1', 'container', 'user1', 1); -- /test1/f1 (rel: /f1) +INSERT INTO node (parent_path, parent_relative_path, name, os_name, type, creator_id, location_id) VALUES ('2.3', '3', 'f2_renamed', 'f2', 'container', 'user1', 1); -- /test1/f1/f2_renamed (rel: /f1/f2) +INSERT INTO node (parent_path, parent_relative_path, name, type, creator_id, location_id) VALUES ('2.3.4', '3.4', 'f3', 'data', 'user1', 1); -- /test1/f1/f2_renamed/f3 (rel: /f1/f2/f3) -INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, is_public, location_id) VALUES ('', NULL, 'test2', 'container', 'user2', 'user2', true, 1); -- /test2 -INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, is_public, location_id) VALUES ('6', '', 'f4', 'container', 'user2', 'user2', true, 1); -- /test2/f4 (rel: /f4) -INSERT INTO node (parent_path, parent_relative_path, name, type, owner_id, creator_id, is_public, location_id) VALUES ('6', '', 'f5', 'container', 'user2', 'user2', true, 1); -- /test2/f5 (rel: /f5) +INSERT INTO node (parent_path, parent_relative_path, name, type, creator_id, is_public, location_id) VALUES ('', NULL, 'test2', 'container', 'user2', true, 1); -- /test2 +INSERT INTO node (parent_path, parent_relative_path, name, type, creator_id, is_public, location_id) VALUES ('6', '', 'f4', 'container', 'user2', true, 1); -- /test2/f4 (rel: /f4) +INSERT INTO node (parent_path, parent_relative_path, name, type, creator_id, is_public, location_id) VALUES ('6', '', 'f5', 'container', 'user2', true, 1); -- /test2/f5 (rel: /f5) DELETE FROM job; @@ -19,4 +19,4 @@ INSERT INTO job (job_id, owner_id, job_type, phase, start_time, end_time, creati INSERT INTO job (job_id, owner_id, job_type, phase, start_time, end_time, creation_time, job_info, results) VALUES ('pippo3', 'user1', 'pullFromVoSpace', 'QUEUED', NULL, NULL, '2013-06-22 19:10:25', NULL, NULL); INSERT INTO job (job_id, owner_id, job_type, phase, start_time, end_time, creation_time, job_info, results) VALUES ('pippo4', 'user2', 'copyNode', 'PENDING', NULL, NULL, '2014-06-22 19:10:25', NULL, NULL); INSERT INTO job (job_id, owner_id, job_type, phase, start_time, end_time, creation_time, job_info, results) VALUES ('pippo5', 'user1', 'pushToVoSpace', 'EXECUTING', NULL, NULL, '2015-06-22 19:10:25', NULL, NULL); -INSERT INTO job (job_id, owner_id, job_type, phase, start_time, end_time, creation_time, job_info, results) VALUES ('pippo6', 'user2', 'pullFromVoSpace', 'PENDING', NULL, NULL, '2015-06-22 19:10:25', NULL, NULL); \ No newline at end of file +INSERT INTO job (job_id, owner_id, job_type, phase, start_time, end_time, creation_time, job_info, results) VALUES ('pippo6', 'user2', 'pullFromVoSpace', 'PENDING', NULL, NULL, '2015-06-22 19:10:25', NULL, NULL);