Package testsuite.clusterj.model

Examples of testsuite.clusterj.model.BlobTypes


        tx.begin();

        for (int i = 1; i < NUMBER_TO_INSERT; ++i) {
            // must be done with an active transaction
            BlobTypes e = session.find(BlobTypes.class, i);
            // see if it is the right one
            int actualId = e.getId();
            if (actualId != i) {
                error("Expected BlobTypes.id " + i + " but got " + actualId);
            }
            byte[] bytes = e.getBlobbytes();
            // make sure all fields were fetched properly
            checkBlobBytes("before update", bytes, i, false);

            int position = getBlobSizeFor(i)/2;
            // only update if the length is correct
            if (bytes.length == (position * 2)) {
                // modify the byte in the middle of the blob
                bytes[position] = (byte)(position % 128);
                checkBlobBytes("after update", bytes, i, true);

                // mark the field as modified so it will be flushed
                session.markModified(e, "blobbytes");

                // update the modified instance
                session.updatePersistent(e);
            }
        }
        tx.commit();
        tx.begin();

        for (int i = 1; i < NUMBER_TO_INSERT; ++i) {
            // must be done with an active transaction
            BlobTypes e = session.find(BlobTypes.class, i);
            // see if it is the right one
            int actualId = e.getId();
            if (actualId != i) {
                error("Expected BlobTypes.id " + i + " but got " + actualId);
            }
            byte[] bytes = e.getBlobbytes();

            // check to see that the blob field has the right data
            checkBlobBytes("after commit", e.getBlobbytes(), i, true);
        }
        tx.commit();
    }
View Full Code Here


        tx.commit();
    }

    protected void createBlobInstances(int number) {
        for (int i = 0; i < number; ++i) {
            BlobTypes instance = session.newInstance(BlobTypes.class);
            instance.setId(i);
            int length = getBlobSizeFor(i);
            instance.setBlobbytes(getBlobBytes(length));
//            blob streams are not yet supported
//            instance.setBlobstream(getBlobStream(length));
            blobs.add(instance);
        }
    }
View Full Code Here

TOP

Related Classes of testsuite.clusterj.model.BlobTypes

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.