Package org.apache.geronimo.datastore.impl

Examples of org.apache.geronimo.datastore.impl.GFileDAO


        props.put("name1", "value1");
        props.put("name2", "value2");
        byte[] content = "Dummy content".getBytes();
        ByteArrayInputStream in = new ByteArrayInputStream(content);
        GFileTO fileTO = new GFileTO(path, props, in);
        GFileDAO fileDAO = new LocalGFileDAO(root);

        // Create.
        fileDAO.create(fileTO);
       
        // Read.
        fileTO = fileDAO.read(path);
        assertEquals("Wrong path", path, fileTO.getPath());
        props = fileTO.getProperties();
        assertEquals("Wrong # of properties", 2, props.size());
        for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) {
            Map.Entry property = (Map.Entry) iter.next();
            String name = (String) property.getKey();
            if ( name.equals("name1") ) {
                assertEquals("Wrong value", "value1", property.getValue());
            } else if ( name.equals("name2") ) {
                assertEquals("Wrong value", "value2", property.getValue());
            } else {
                assertTrue("Wrong property name {" + name + "}", false);
            }
        }
       
        // Update
        props.put("name3", "value3");
        fileDAO.update(fileTO);
        fileTO = fileDAO.read(path);
        props = fileTO.getProperties();
        assertEquals("Wrong # of properties", 3, props.size());
       
        // Delete
        fileDAO.delete(path);
        fileTO = fileDAO.read(path);
        assertFalse("Should not exist.", fileTO.exists());
    }
View Full Code Here


        props.put("name1", "value1");
        props.put("name2", "value2");
        byte[] content = "Dummy content".getBytes();
        ByteArrayInputStream in = new ByteArrayInputStream(content);
        GFileTO fileTO = new GFileTO(path, props, in);
        GFileDAO fileDAO = new LocalGFileDAO(root);

        // Create.
        fileDAO.create(fileTO);
       
        // Read.
        fileTO = fileDAO.read(path);
        assertEquals("Wrong path", path, fileTO.getPath());
        props = fileTO.getProperties();
        assertEquals("Wrong # of properties", 2, props.size());
        for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) {
            Map.Entry property = (Map.Entry) iter.next();
            String name = (String) property.getKey();
            if ( name.equals("name1") ) {
                assertEquals("Wrong value", "value1", property.getValue());
            } else if ( name.equals("name2") ) {
                assertEquals("Wrong value", "value2", property.getValue());
            } else {
                assertTrue("Wrong property name {" + name + "}", false);
            }
        }
       
        // Update
        props.put("name3", "value3");
        fileDAO.update(fileTO);
        fileTO = fileDAO.read(path);
        props = fileTO.getProperties();
        assertEquals("Wrong # of properties", 3, props.size());
       
        // Delete
        fileDAO.delete(path);
        fileTO = fileDAO.read(path);
        assertFalse("Should not exist.", fileTO.exists());
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.datastore.impl.GFileDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.