Commit af113ab6 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Length property must be always present

parent f0b2fe89
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -187,8 +187,9 @@ public class NodeDAO {

        List<Property> properties = new ArrayList<>();

        addProperty(NodeProperties.LENGTH_URI, rs.getString("content_length"),
                properties);
        // Content length is required for CADC client compatibility
        String contentLength = rs.getString("content_length");
        addProperty(NodeProperties.LENGTH_URI, contentLength == null ? "0" : contentLength, properties);

        String creationTime = rs.getString("created_on").replace(" ", "T");
        
+2 −1
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ public class NodeDAOTest {
        ContainerNode root = (ContainerNode) dao.listNode("/").get();
        assertEquals(2, root.getNodes().size());

        assertEquals("true", NodeProperties.getNodePropertyAsListByURI(root, NodeProperties.PUBLIC_READ_URI).get(0));
        assertEquals("true", NodeProperties.getNodePropertyByURI(root, NodeProperties.PUBLIC_READ_URI));
        assertEquals("0", NodeProperties.getNodePropertyByURI(root, NodeProperties.LENGTH_URI));

        assertEquals("group1 group2", NodeProperties.getNodePropertyByURI(root.getNodes().get(0), NodeProperties.GROUP_READ_URI));