Package com.orientechnologies.orient.core.db.record

Examples of com.orientechnologies.orient.core.db.record.ODatabaseFlat


    database.close();
  }

  @Test(dependsOnMethods = "testDictionaryMassiveCreate")
  public void testDictionaryInTx() throws IOException {
    ODatabaseFlat database = new ODatabaseFlat(url);
    database.open("admin", "admin");

    database.begin();
    database.getDictionary().put("tx-key", database.newInstance().value("tx-test-dictionary"));
    database.commit();

    Assert.assertNotNull(database.getDictionary().get("tx-key"));

    database.close();
  }
View Full Code Here


    super(url);
  }

  @Override
  protected ODatabaseFlat createDatabaseInstance(String url) {
    return new ODatabaseFlat(url);
  }
View Full Code Here

    super(url);
  }

  @Test
  public void testTransactionAtomic() throws IOException {
    ODatabaseFlat db1 = new ODatabaseFlat(url);
    db1.open("admin", "admin");

    ODatabaseFlat db2 = new ODatabaseFlat(url);
    db2.open("admin", "admin");

    ORecordFlat record1 = new ORecordFlat(db1);
    record1.value("This is the first version").save();

    // RE-READ THE RECORD
    record1.reload();
    ORecordFlat record2 = db2.load(record1.getIdentity());

    record2.value("This is the second version").save();
    record2.value("This is the third version").save();

    record1.reload(null, true);

    Assert.assertEquals(record1.value(), "This is the third version");

    db1.close();
    db2.close();
  }
View Full Code Here

    }
  }

  @Test(expectedExceptions = OTransactionException.class)
  public void testTransactionPreListenerRollback() throws IOException {
    ODatabaseFlat db = new ODatabaseFlat(url);
    db.open("admin", "admin");

    ORecordFlat record1 = new ORecordFlat(db);
    record1.value("This is the first version").save();

    db.registerListener(new ODatabaseListener() {

      @Override
      public void onAfterTxCommit(ODatabase iDatabase) {
      }

      @Override
      public void onAfterTxRollback(ODatabase iDatabase) {
      }

      @Override
      public void onBeforeTxBegin(ODatabase iDatabase) {
      }

      @Override
      public void onBeforeTxCommit(ODatabase iDatabase) {
        throw new RuntimeException("Rollback test");
      }

      @Override
      public void onBeforeTxRollback(ODatabase iDatabase) {
      }

      @Override
      public void onClose(ODatabase iDatabase) {
      }

      @Override
      public void onCreate(ODatabase iDatabase) {
      }

      @Override
      public void onDelete(ODatabase iDatabase) {
      }

      @Override
      public void onOpen(ODatabase iDatabase) {
      }

      @Override
      public boolean onCorruptionRepairDatabase(ODatabase iDatabase, final String iReason, String iWhatWillbeFixed) {
        return true;
      }
    });

    db.begin();
    db.commit();

    db.close();
  }
View Full Code Here

  }

  public DictionaryLookupSpeedTest() {
    super(100000);
    Orient.instance().getProfiler().startRecording();
    database = new ODatabaseFlat(System.getProperty("url")).open("admin", "admin");
  }
View Full Code Here

  @Override
  public void init() {
    Orient.instance().getProfiler().startRecording();

    database = new ODatabaseFlat(System.getProperty("url")).open("admin", "admin");
    record = new ORecordBytes();

    database.declareIntent(new OIntentMassiveInsert());
    database.begin(TXTYPE.NOTX);
    Random rnd = new Random();
View Full Code Here

  }

  public DictionaryLookupInverseSpeedTest() {
    super(100000);
    Orient.instance().getProfiler().startRecording();
    database = new ODatabaseFlat(System.getProperty("url")).open("admin", "admin");
  }
View Full Code Here

  public DictionaryPutSpeedTest() throws InstantiationException, IllegalAccessException {
    super(1000000);

    String url = System.getProperty("url");
    database = new ODatabaseFlat(url).open("admin", "admin");
    database.declareIntent(new OIntentMassiveInsert());

    record = database.newInstance();
    startNum = 0;// database.countClusterElements("Animal");
View Full Code Here

  @Override
  public void init() {
    Orient.instance().getProfiler().startRecording();

    database = new ODatabaseFlat(System.getProperty("url")).open("admin", "admin");
    record = database.newInstance();

    database.begin();
  }
View Full Code Here

  @Override
  public void init() {
    Orient.instance().getProfiler().startRecording();

    database = new ODatabaseFlat(System.getProperty("url"));
    if (database.exists())
      database.open("admin", "admin");
    else
      database.create();
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.db.record.ODatabaseFlat

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.