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 38137e68264480af5b94165430a906fc9c4fbeef..640eeec04e37a841a3aba8212d2e8858687051ba 100644 --- a/src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java +++ b/src/main/java/it/inaf/oats/vospace/persistence/NodeDAO.java @@ -140,25 +140,6 @@ public class NodeDAO { return Optional.of(node); } - public List<String> listNodeChildren(String path) { - - String sql = "SELECT n.name\n" - + "FROM node n\n" - + "WHERE n.path ~ ('*.' || id_from_vos_path(?) || '.*{1}')::lquery\n" - + "ORDER BY n.path"; - - List<String> childrenNames = jdbcTemplate.query(conn -> { - PreparedStatement ps = conn.prepareStatement(sql); - int i = 0; - ps.setString(++i, path); - return ps; - }, (row, index) -> { - return row.getString("name"); - }); - - return childrenNames; - } - public Node setNode(Node newNode) { return setNode(newNode, false); } diff --git a/src/test/java/it/inaf/oats/vospace/persistence/NodeDAOTest.java b/src/test/java/it/inaf/oats/vospace/persistence/NodeDAOTest.java index f1c2107422f030e378787a4c1c045859af32210a..30e8fe6a71756372d73ffc3392ddf76d04afd25f 100644 --- a/src/test/java/it/inaf/oats/vospace/persistence/NodeDAOTest.java +++ b/src/test/java/it/inaf/oats/vospace/persistence/NodeDAOTest.java @@ -50,7 +50,7 @@ public class NodeDAOTest { ReflectionTestUtils.setField(dao, "authority", AUTHORITY); } - + @Test public void testCreateNode() { DataNode dataNode = new DataNode(); @@ -100,16 +100,6 @@ public class NodeDAOTest { assertEquals(bTime, NodeProperties.getNodePropertyByURI(root.getNodes().get(0), NodeProperties.DATE_URI)); } - @Test - public void testListNodeChildren() { - assertTrue(dao.listNodeChildren("/test4").isEmpty()); - List<String> children = dao.listNodeChildren("/test2"); - assertFalse(children.isEmpty()); - assertTrue(children.size() == 2); - assertTrue(children.containsAll(List.of("f4", "f5"))); - - } - @Test public void testGetQuotaAndMD5() { @@ -285,7 +275,7 @@ public class NodeDAOTest { } - + @Test public void testMoveNodeBranch() { // Let's move /test3/m1 to /test3/group1 @@ -321,7 +311,7 @@ public class NodeDAOTest { Optional<Long> optSourceChildId = dao.getNodeId("/test3/m1/m2"); assertTrue(optSourceChildId.isPresent()); - + Optional<Long> optSourceChildLinkId = dao.getNodeId("/test3/m1/link1"); assertTrue(optSourceChildLinkId.isPresent()); @@ -341,38 +331,38 @@ public class NodeDAOTest { Optional<Long> recheckSourceChild = dao.getNodeId("/test3/m1/m2"); assertTrue(recheckSourceChild.isPresent()); - + Optional<Long> resultIdChildLink = dao.getNodeId("/test3/group1/copy_of_m1/link1"); assertTrue(resultIdChildLink.isPresent()); - + Optional<Long> recheckSourceChildLink = dao.getNodeId("/test3/m1/link1"); assertTrue(recheckSourceChildLink.isPresent()); } - + @Test public void testMoveAndCopyIntegrated() { - + assertTrue(dao.getNodeId("/mycontainer").isPresent()); assertTrue(dao.getNodeId("/mycontainer/destination2").isPresent()); assertTrue(dao.getNodeId("/mycontainer/destination2/control").isPresent()); - + dao.copyBranch("/mycontainer/destination2/control", "/mycontainer/control"); - + assertTrue(dao.getNodeId("/mycontainer/container1").isPresent()); - - Optional<ShortNodeDescriptor> optSnd = + + Optional<ShortNodeDescriptor> optSnd = dao.getShortNodeDescriptor("/mycontainer/destination2", "user3", List.of("group1")); - + dao.moveNodeBranch(dao.getNodeId("/mycontainer/container1").get(), optSnd.get().getDestinationNodeLtreePath()); - + assertTrue(dao.getNodeId("/mycontainer/destination2/container1").isPresent()); - assertTrue(dao.getNodeId("/mycontainer/container1").isEmpty()); + assertTrue(dao.getNodeId("/mycontainer/container1").isEmpty()); dao.copyBranch("/mycontainer/destination2/container1", "/mycontainer/container1"); - + assertTrue(dao.getNodeId("/mycontainer/container1").isPresent()); } - + @Test public void testRenameNode() {