Package com.orientechnologies.orient.core.record.impl

Examples of com.orientechnologies.orient.core.record.impl.ORecordBytes.save()


      ODatabaseRecordThreadLocal.INSTANCE.set(db2);
      ORecordBytes record2 = db2.load(record1.getIdentity());

      record2.setDirty();
      record2.fromStream("This is the second version".getBytes());
      record2.save();

      ODatabaseRecordThreadLocal.INSTANCE.set(database);
      record1.setDirty();
      record1.fromStream("This is the third version".getBytes());
      record1.save();
View Full Code Here


  public void testTransactionOptimisticCacheMgmt1Db() throws IOException {
    if (database.getClusterIdByName("binary") == -1)
      database.addCluster("binary");

    ORecordBytes record = new ORecordBytes("This is the first version".getBytes());
    record.save();

    try {
      database.begin();

      // RE-READ THE RECORD
View Full Code Here

      // RE-READ THE RECORD
      record.load();
      int v1 = record.getRecordVersion().getCounter();
      record.setDirty();
      record.fromStream("This is the second version".getBytes());
      record.save();
      database.commit();

      record.reload();
      Assert.assertEquals(record.getRecordVersion().getCounter(), v1 + 1);
      Assert.assertTrue(new String(record.toStream()).contains("second"));
View Full Code Here

    ODatabaseDocumentTx db2 = new ODatabaseDocumentTx(database.getURL());
    db2.open("admin", "admin");

    ORecordBytes record1 = new ORecordBytes("This is the first version".getBytes());
    record1.save();

    try {
      ODatabaseRecordThreadLocal.INSTANCE.set(database);
      database.begin();
View Full Code Here

      // RE-READ THE RECORD
      record1.load();
      int v1 = record1.getRecordVersion().getCounter();
      record1.setDirty();
      record1.fromStream("This is the second version".getBytes());
      record1.save();

      database.commit();

      ODatabaseRecordThreadLocal.INSTANCE.set(db2);
View Full Code Here

  }

  @Test
  public void testBasicCreateExternal() {
    ORecordBytes record = new ORecordBytes(database, "This is a test".getBytes());
    record.save();
    rid = record.getIdentity();
  }

  @Test(dependsOnMethods = "testBasicCreateExternal")
  public void testBasicReadExternal() {
View Full Code Here

    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = database.newInstance(JavaComplexTestClass.class);
    byte[] thumbnailImageBytes = "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2"
        .getBytes();
    ORecordBytes oRecordBytes = new ORecordBytes(database.getUnderlying(), thumbnailImageBytes);
    oRecordBytes.save();
    p.setByteArray(oRecordBytes);
    p = database.save(p);
    Assert.assertTrue(p.getByteArray() instanceof ORecordBytes);
    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

    database.close();
    database = OObjectDatabasePool.global().acquire(url, "admin", "admin");
    p = new JavaComplexTestClass();
    thumbnailImageBytes = "this is a bytearray test. if you read this Object database has stored it correctlyVERSION2".getBytes();
    oRecordBytes = new ORecordBytes(database.getUnderlying(), thumbnailImageBytes);
    oRecordBytes.save();
    p.setByteArray(oRecordBytes);
    p = database.save(p);
    Assert.assertTrue(p.getByteArray() instanceof ORecordBytes);
    try {
      ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

        }

        // Save the chunk to the database.
        final long saveStartTime = System.currentTimeMillis();
        chunk.reset(buffer);
        chunk.save();
        final long saveMs = System.currentTimeMillis() - saveStartTime;

        // Log the amount of time taken by the save.
        System.out.printf("Saved chunk %d in %d ms.\n", page, saveMs);
View Full Code Here

        }

        // Save the chunk to the database.
        final long saveStartTime = System.currentTimeMillis();
        chunk.reset(Arrays.copyOf(buffer, remainder));
        chunk.save();
        final long saveMs = System.currentTimeMillis() - saveStartTime;

        // Log the amount of time taken by the save.
        System.out.printf("Saved partial chunk %d in %d ms.\n", fullChunks, saveMs);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.