Package org.apache.openjpa.persistence.kernel.common.apps

Examples of org.apache.openjpa.persistence.kernel.common.apps.BlobTest


    public void testStoreBlob() {
        OpenJPAEntityManager pm;

        pm = getPM(false, false);
        startTx(pm);
        BlobTest blob = new BlobTest();
        byte[] bytes = new byte[2048];
        for (int i = 0; i < bytes.length; i++)
            bytes[i] = randomByte().byteValue();

        blob.setBlob(bytes);
        pm.persist(blob);
        int id = blob.getId();
        endTx(pm);

        byte[] b1 = blob.getBlob();
        endEm(pm);

        pm = getPM(false, false);
        startTx(pm);
        BlobTest blob2 = pm.find(BlobTest.class, id);

        byte[] b2 = blob2.getBlob();

        assertNotNull("Original blob was null", b1);
        assertNotNull("Retrieved blob was null", b2);
        assertEquals("Blob length was not the same", b1.length, b2.length);
        assertBytesEquals("Blob contents did not match", b1, b2);
View Full Code Here


    public void testStoreBlob() {
        OpenJPAEntityManager pm;

        pm = getPM(false, false);
        startTx(pm);
        BlobTest blob = new BlobTest();
        byte[] bytes = new byte[2048];
        for (int i = 0; i < bytes.length; i++)
            bytes[i] = randomByte().byteValue();

        blob.setBlob(bytes);
        pm.persist(blob);
        int id = blob.getId();
        endTx(pm);

        byte[] b1 = blob.getBlob();
        endEm(pm);

        pm = getPM(false, false);
        startTx(pm);
        BlobTest blob2 = pm.find(BlobTest.class, id);

        byte[] b2 = blob2.getBlob();

        assertNotNull("Original blob was null", b1);
        assertNotNull("Retrieved blob was null", b2);
        assertEquals("Blob length was not the same", b1.length, b2.length);
        assertBytesEquals("Blob contents did not match", b1, b2);
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.kernel.common.apps.BlobTest

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.