Package com.orientechnologies.orient.core.db.document

Examples of com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.query()


    ODatabaseDocumentTx database;
    int i;
    for (ServerRun server : serverInstance) {
      database = ODatabaseDocumentPool.global().acquire(getDatabaseURL(server), "admin", "admin");
      try {
        List<ODocument> result = database.query(new OSQLSynchQuery<OIdentifiable>("select count(*) from Person"));
        final long total = result.get(0).field("count");

        if (total != (long) (count * serverInstance.size()) + beginInstances) {
          // ERROR: DUMP ALL THE RECORDS
          result = database.query(new OSQLSynchQuery<OIdentifiable>("select from Person"));
View Full Code Here


        List<ODocument> result = database.query(new OSQLSynchQuery<OIdentifiable>("select count(*) from Person"));
        final long total = result.get(0).field("count");

        if (total != (long) (count * serverInstance.size()) + beginInstances) {
          // ERROR: DUMP ALL THE RECORDS
          result = database.query(new OSQLSynchQuery<OIdentifiable>("select from Person"));
          i = 0;
          for (ODocument d : result) {
            System.out.println((i++) + ": " + d);
          }
        }
View Full Code Here

  }

  private void printStats(final String databaseUrl) {
    final ODatabaseDocumentTx database = ODatabaseDocumentPool.global().acquire(databaseUrl, "admin", "admin");
    try {
      List<ODocument> result = database.query(new OSQLSynchQuery<OIdentifiable>("select count(*) from Person"));

      final String name = database.getURL();

      System.out.println("\nReader " + name + " sql count: " + result.get(0) + " counting class: " + database.countClass("Person")
          + " counting cluster: " + database.countClusterElements("Person"));
View Full Code Here

      System.out.println("\nReader " + name + " sql count: " + result.get(0) + " counting class: " + database.countClass("Person")
          + " counting cluster: " + database.countClusterElements("Person"));

      if (database.getMetadata().getSchema().existsClass("ODistributedConflict"))
        try {
          List<ODocument> conflicts = database
              .query(new OSQLSynchQuery<OIdentifiable>("select count(*) from ODistributedConflict"));
          long totalConflicts = conflicts.get(0).field("count");
          Assert.assertEquals(0l, totalConflicts);
          System.out.println("\nReader " + name + " conflicts: " + totalConflicts);
        } catch (OQueryParsingException e) {
View Full Code Here

            times.add(time);

            start = System.currentTimeMillis();
            for (int j = 0; j < operations_read; j++) {
              List<DummyObject> l = tx.query(new OSQLSynchQuery<DummyObject>(" select * from DummyObject "));
              Assert.assertEquals(l.size(), operations_write);

              if ((j + 1) % 20000 == 0) {
                System.out.println("(" + getDbId(tx) + ") " + "Operations (READ) executed: " + j + 1);
                System.out.flush();
View Full Code Here

    document.reset();

    document.setClassName("RenameClassTest");
    document.save();

    List<ODocument> result = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>("select from RenameClassTest"));
    Assert.assertEquals(result.size(), 2);

    oClass.set(OClass.ATTRIBUTES.NAME, "RenameClassTest2");

    result = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>("select from RenameClassTest2"));
View Full Code Here

    List<ODocument> result = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>("select from RenameClassTest"));
    Assert.assertEquals(result.size(), 2);

    oClass.set(OClass.ATTRIBUTES.NAME, "RenameClassTest2");

    result = databaseDocumentTx.query(new OSQLSynchQuery<ODocument>("select from RenameClassTest2"));
    Assert.assertEquals(result.size(), 2);
  }

  public void testMinimumClustersAndClusterSelection() {
    ODatabaseDocumentTx databaseDocumentTx = new ODatabaseDocumentTx(url);
View Full Code Here

    testLinkClassDocument.field("testBoolean", true);
    testClassDocument.field("testLink", testLinkClassDocument);
    testClassDocument.save();
    // THIS WILL THROW A java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to
    // java.lang.Boolean
    List<ODocument> result = db.query(new OSQLSynchQuery<ODocument>("select from TestClass where testLink.testBoolean = true"));
    Assert.assertEquals(result.size(), 1);
    // THIS WILL THROW A java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to
    // java.lang.String
    result = db.query(new OSQLSynchQuery<ODocument>("select from TestClass where testLink.testString = 'Test Link Class 1'"));
    Assert.assertEquals(result.size(), 1);
View Full Code Here

    // java.lang.Boolean
    List<ODocument> result = db.query(new OSQLSynchQuery<ODocument>("select from TestClass where testLink.testBoolean = true"));
    Assert.assertEquals(result.size(), 1);
    // THIS WILL THROW A java.lang.ClassCastException: com.orientechnologies.orient.core.id.ORecordId cannot be cast to
    // java.lang.String
    result = db.query(new OSQLSynchQuery<ODocument>("select from TestClass where testLink.testString = 'Test Link Class 1'"));
    Assert.assertEquals(result.size(), 1);

    db.close();
  }
View Full Code Here

        countDownLatch.await();
        while (createCounter.get() < DOCUMENT_COUNT) {
          ODatabaseHelper.freezeDatabase(database);
          database.open("admin", "admin");

          final List<ODocument> beforeNonTxDocuments = database.query(new OSQLSynchQuery<Object>("select from "
              + STUDENT_CLASS_NAME));
          final List<ODocument> beforeTxDocuments = database.query(new OSQLSynchQuery<Object>("select from " + TRANSACTIONAL_WORD
              + STUDENT_CLASS_NAME));

          database.close();
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.