Package org.javalite.activejdbc.test_models

Examples of org.javalite.activejdbc.test_models.Image


*/
public class BlobTest extends ActiveJDBCTest {

    @Test
    public void shouldWriteAndReadBytesToDb() throws SQLException, IOException {
        Image image = new Image();
        byte[] igorBytes = Util.readResourceBytes("/igor.jpg");
        image.set("name", "igor's head");
        image.set("content", igorBytes);
        image.saveIt();

        Image igor1 = (Image) Image.findAll().get(0);
        byte[] igor1Bytes = igor1.getBytes("content");
        assertEqual(igorBytes, igor1Bytes);
    }
View Full Code Here

TOP

Related Classes of org.javalite.activejdbc.test_models.Image

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.