Examples of RqlObject


Examples of com.dkhenry.RethinkDB.RqlObject

        String database = new BigInteger(130, random).toString(32);
        String table = new BigInteger(130, random).toString(32);
        RqlConnection r = RqlConnection.connect("localhost",28015);
        RqlCursor cursor = r.run(r.db_create(database));

        RqlObject obj = cursor.next();
        assert Double.valueOf(1.0).equals(obj.getAs("created")) : "Database was not created successfully ";

        cursor = r.run(r.db(database).table_create(table));
        obj = cursor.next();

        assert Double.valueOf(1.0).equals(obj.getAs("created")) : "Table was not created successfully";
        cursor = r.run(r.db(database).table(table).insert( Arrays.asList(
                new HashMap() {{
                    put("TestForNullInsert", null);
                }}
        )));
        assert Double.valueOf(1.0).equals(cursor.next().getAs("inserted")) : "Error inserting null value into Database";

        cursor = r.run(r.db(database).table(table).get_all("TestForNullInsert"));
        obj = cursor.next();
        assert obj.getAs("TestForNullInsert") == null : "Error Getting null value out of database";

        cursor = r.run(r.db(database).table_drop(table));
        assert Double.valueOf(1.0).equals(cursor.next().getAs("dropped")) : "Table was not dropped successfully ";

        r.run(r.db_drop(database));
View Full Code Here

Examples of com.dkhenry.RethinkDB.RqlObject

  public void createAndListDb() throws RqlDriverException {    
    SecureRandom random = new SecureRandom();
    String database = new BigInteger(130, random).toString(32);
    RqlConnection r = RqlConnection.connect("localhost",28015);
    RqlCursor cursor = r.run(r.db_create(database));
    RqlObject obj = cursor.next();         
    assert Double.valueOf(1.0).equals(obj.getAs("created")) : "Database was not created successfully ";
    cursor = r.run(r.db_list());
    obj = cursor.next();
    boolean found = false;
    for(Object o: obj.getList()) {
      if( database.equals(o)) {
        found = true;
        break;
      }       
    }
    assert found == true : "Database was not able to be listed";
    cursor = r.run(r.db_drop(database));
    obj = cursor.next();
    assert Double.valueOf(1.0).equals(obj.getAs("dropped")) : "Database was not dropped successfully ";
    r.close();
  }
View Full Code Here

Examples of com.dkhenry.RethinkDB.RqlObject

                            put("name",new BigInteger(64,random).toString(32));
                        }}
                );
            }
            RqlCursor cursor = r.run(r.db(database).table(table).insert( l ));
            RqlObject obj = cursor.next();
            Double result = obj.getAs("inserted");
            assert result == rowsPerIteration : "Error inserting Data into Database on iteration " + j + " (" + result + " did not equal " + rowsPerIteration +")";
        }
        RqlCursor cursor = r.run(r.db(database).table(table).count());
        assert Double.valueOf(numberOfIterations*rowsPerIteration).equals(cursor.next().getNumber()) : "Error getting large row count";

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.