Commit 03d32b5d authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Removed unused code

parent a64d0815
Pipeline #2334 passed with stages
in 2 minutes and 31 seconds
...@@ -140,25 +140,6 @@ public class NodeDAO { ...@@ -140,25 +140,6 @@ public class NodeDAO {
return Optional.of(node); 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) { public Node setNode(Node newNode) {
return setNode(newNode, false); return setNode(newNode, false);
} }
......
...@@ -50,7 +50,7 @@ public class NodeDAOTest { ...@@ -50,7 +50,7 @@ public class NodeDAOTest {
ReflectionTestUtils.setField(dao, "authority", AUTHORITY); ReflectionTestUtils.setField(dao, "authority", AUTHORITY);
} }
@Test @Test
public void testCreateNode() { public void testCreateNode() {
DataNode dataNode = new DataNode(); DataNode dataNode = new DataNode();
...@@ -100,16 +100,6 @@ public class NodeDAOTest { ...@@ -100,16 +100,6 @@ public class NodeDAOTest {
assertEquals(bTime, NodeProperties.getNodePropertyByURI(root.getNodes().get(0), NodeProperties.DATE_URI)); 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 @Test
public void testGetQuotaAndMD5() { public void testGetQuotaAndMD5() {
...@@ -285,7 +275,7 @@ public class NodeDAOTest { ...@@ -285,7 +275,7 @@ public class NodeDAOTest {
} }
@Test @Test
public void testMoveNodeBranch() { public void testMoveNodeBranch() {
// Let's move /test3/m1 to /test3/group1 // Let's move /test3/m1 to /test3/group1
...@@ -321,7 +311,7 @@ public class NodeDAOTest { ...@@ -321,7 +311,7 @@ public class NodeDAOTest {
Optional<Long> optSourceChildId = dao.getNodeId("/test3/m1/m2"); Optional<Long> optSourceChildId = dao.getNodeId("/test3/m1/m2");
assertTrue(optSourceChildId.isPresent()); assertTrue(optSourceChildId.isPresent());
Optional<Long> optSourceChildLinkId = dao.getNodeId("/test3/m1/link1"); Optional<Long> optSourceChildLinkId = dao.getNodeId("/test3/m1/link1");
assertTrue(optSourceChildLinkId.isPresent()); assertTrue(optSourceChildLinkId.isPresent());
...@@ -341,38 +331,38 @@ public class NodeDAOTest { ...@@ -341,38 +331,38 @@ public class NodeDAOTest {
Optional<Long> recheckSourceChild = dao.getNodeId("/test3/m1/m2"); Optional<Long> recheckSourceChild = dao.getNodeId("/test3/m1/m2");
assertTrue(recheckSourceChild.isPresent()); assertTrue(recheckSourceChild.isPresent());
Optional<Long> resultIdChildLink = dao.getNodeId("/test3/group1/copy_of_m1/link1"); Optional<Long> resultIdChildLink = dao.getNodeId("/test3/group1/copy_of_m1/link1");
assertTrue(resultIdChildLink.isPresent()); assertTrue(resultIdChildLink.isPresent());
Optional<Long> recheckSourceChildLink = dao.getNodeId("/test3/m1/link1"); Optional<Long> recheckSourceChildLink = dao.getNodeId("/test3/m1/link1");
assertTrue(recheckSourceChildLink.isPresent()); assertTrue(recheckSourceChildLink.isPresent());
} }
@Test @Test
public void testMoveAndCopyIntegrated() { public void testMoveAndCopyIntegrated() {
assertTrue(dao.getNodeId("/mycontainer").isPresent()); assertTrue(dao.getNodeId("/mycontainer").isPresent());
assertTrue(dao.getNodeId("/mycontainer/destination2").isPresent()); assertTrue(dao.getNodeId("/mycontainer/destination2").isPresent());
assertTrue(dao.getNodeId("/mycontainer/destination2/control").isPresent()); assertTrue(dao.getNodeId("/mycontainer/destination2/control").isPresent());
dao.copyBranch("/mycontainer/destination2/control", "/mycontainer/control"); dao.copyBranch("/mycontainer/destination2/control", "/mycontainer/control");
assertTrue(dao.getNodeId("/mycontainer/container1").isPresent()); assertTrue(dao.getNodeId("/mycontainer/container1").isPresent());
Optional<ShortNodeDescriptor> optSnd = Optional<ShortNodeDescriptor> optSnd =
dao.getShortNodeDescriptor("/mycontainer/destination2", "user3", List.of("group1")); dao.getShortNodeDescriptor("/mycontainer/destination2", "user3", List.of("group1"));
dao.moveNodeBranch(dao.getNodeId("/mycontainer/container1").get(), optSnd.get().getDestinationNodeLtreePath()); dao.moveNodeBranch(dao.getNodeId("/mycontainer/container1").get(), optSnd.get().getDestinationNodeLtreePath());
assertTrue(dao.getNodeId("/mycontainer/destination2/container1").isPresent()); 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"); dao.copyBranch("/mycontainer/destination2/container1", "/mycontainer/container1");
assertTrue(dao.getNodeId("/mycontainer/container1").isPresent()); assertTrue(dao.getNodeId("/mycontainer/container1").isPresent());
} }
@Test @Test
public void testRenameNode() { public void testRenameNode() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment