Package com.dkhenry.RethinkDB

Examples of com.dkhenry.RethinkDB.RqlConnection.run()


            assert m.containsKey("show") : "Data that came back was malformed (missing \"show\")";
            assert "Star Trek Deep Space Nine".equals(m.get("show")) : "Data that came back was just plain wrong (\"show\" was not \"Star Trek Deep Space Nine\")";
        }

        r.run(r.db(database).table_drop(table));
        r.run(r.db_drop(database));   
    r.close();
  }
 
  @SuppressWarnings({ "unchecked", "rawtypes", "serial" })
  @Test(groups={"acceptance"})
View Full Code Here


  public void insertAndRetrieveSingleRow() throws RqlDriverException {
    SecureRandom random = new SecureRandom();
    String database = new BigInteger(130, random).toString(32);
    String table = new BigInteger(130, random).toString(32);
    RqlConnection r = RqlConnection.connect("localhost",28015);
    r.run(r.db_create(database));
    r.run(r.db(database).table_create(table));
   
    RqlCursor cursor = r.run(r.db(database).table(table).insert( Arrays.asList(       
        new HashMap() {{ put("name","Worf");put("show","Star Trek TNG"); }},
          new HashMap() {{ put("name","Data");put("show","Star Trek TNG"); }},
View Full Code Here

    SecureRandom random = new SecureRandom();
    String database = new BigInteger(130, random).toString(32);
    String table = new BigInteger(130, random).toString(32);
    RqlConnection r = RqlConnection.connect("localhost",28015);
    r.run(r.db_create(database));
    r.run(r.db(database).table_create(table));
   
    RqlCursor cursor = r.run(r.db(database).table(table).insert( Arrays.asList(       
        new HashMap() {{ put("name","Worf");put("show","Star Trek TNG"); }},
          new HashMap() {{ put("name","Data");put("show","Star Trek TNG"); }},
          new HashMap() {{ put("name","William Adama");put("show","Battlestar Galactica"); }},
View Full Code Here

    String table = new BigInteger(130, random).toString(32);
    RqlConnection r = RqlConnection.connect("localhost",28015);
    r.run(r.db_create(database));
    r.run(r.db(database).table_create(table));
   
    RqlCursor cursor = r.run(r.db(database).table(table).insert( Arrays.asList(       
        new HashMap() {{ put("name","Worf");put("show","Star Trek TNG"); }},
          new HashMap() {{ put("name","Data");put("show","Star Trek TNG"); }},
          new HashMap() {{ put("name","William Adama");put("show","Battlestar Galactica"); }},
          new HashMap() {{ put("name","Homer Simpson");put("show","The Simpsons"); }}
            ),
View Full Code Here

    List generatedKeys = cursor.next().getAs("generated_keys");
   
    Iterator it = generatedKeys.iterator();
   
    while (it.hasNext()){
      cursor = r.run(r.db(database).table(table).get(it.next()));
      for(RqlObject o: cursor) {
        assert o.toString() != null : "Failed to get single row";
      }       
    }
   
View Full Code Here

      for(RqlObject o: cursor) {
        assert o.toString() != null : "Failed to get single row";
      }       
    }
   
        r.run(r.db(database).table_drop(table));
        r.run(r.db_drop(database));   
    r.close();
  }

View Full Code Here

        assert o.toString() != null : "Failed to get single row";
      }       
    }
   
        r.run(r.db(database).table_drop(table));
        r.run(r.db_drop(database));   
    r.close();
  }


    @SuppressWarnings({ "unchecked", "rawtypes", "serial" })
View Full Code Here

        final double numberOfIterations = 256.0;
        final SecureRandom random = new SecureRandom();
        String database = new BigInteger(130, random).toString(32);
        String table = new BigInteger(130, random).toString(32);
        RqlConnection r = RqlConnection.connect("localhost",28015);
        r.run(r.db_create(database));
        r.run(r.db(database).table_create(table));

        for( long j =0 ; j < numberOfIterations ; j++ ) {
            List<Object> l = new ArrayList<Object>();
            System.out.println("Inserting Rows...") ;
View Full Code Here

        final SecureRandom random = new SecureRandom();
        String database = new BigInteger(130, random).toString(32);
        String table = new BigInteger(130, random).toString(32);
        RqlConnection r = RqlConnection.connect("localhost",28015);
        r.run(r.db_create(database));
        r.run(r.db(database).table_create(table));

        for( long j =0 ; j < numberOfIterations ; j++ ) {
            List<Object> l = new ArrayList<Object>();
            System.out.println("Inserting Rows...") ;
            for( long i = 0 ; i < rowsPerIteration ; i++ ) {
View Full Code Here

                            put("id",BigInteger.valueOf(id).toString(32) );
                            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());
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.