Package org.conserve.objects

Examples of org.conserve.objects.BlobClobObject


   */
  @Test
  public void testBlobClob() throws Exception
  {
    PersistenceManager persist = new PersistenceManager(driver, database, login, password);
    BlobClobObject bco = new BlobClobObject();
    bco.setBytes(new byte[] { 3, 54, 1, 9 });
    bco.setChars(new char[] { 'a', 'b', 'c' });
    persist.saveObject(bco);

    // re-open the persistence object
    persist.close();
    persist = new PersistenceManager(driver, database, login, password);
    // make sure countworks for CLOB/BLOB objects
    long clobCount = persist.getCount(new BlobClobObject());
    assertEquals(1, clobCount);
    // get the one and only bco object
    List<BlobClobObject> all = persist.getObjectsMatching(new BlobClobObject());
    assertEquals(1, all.size());
    BlobClobObject first = all.get(0);
    assertEquals(bco.getBytes().length, first.getBytes().length);
    assertEquals(bco.getChars().length, first.getChars().length);
    for (int x = 0; x < bco.getChars().length; x++)
    {
      assertEquals(bco.getChars()[x], first.getChars()[x]);
    }
    for (int x = 0; x < bco.getBytes().length; x++)
    {
      assertEquals(bco.getBytes()[x], first.getBytes()[x]);
    }
    persist.close();
  }
View Full Code Here

TOP

Related Classes of org.conserve.objects.BlobClobObject

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.