Package com.findwise.hydra.local

Examples of com.findwise.hydra.local.LocalQuery.toJson()


  @Test
  public void testRequireAction() throws JsonException {
    MongoConnector mdc = mongoConnectorResource.getConnector();
    LocalQuery q = new LocalQuery();
    q.requireAction(Action.UPDATE);
    List<DatabaseDocument<MongoType>> ds = mdc.getDocumentReader().getDocuments(new MongoQuery(q.toJson()), 3);
    if(ds.size()!=0) {
      fail("Got documents for UPDATE, shouldn't have.");
    }
   
    q = new LocalQuery();
View Full Code Here


      fail("Got documents for UPDATE, shouldn't have.");
    }
   
    q = new LocalQuery();
    q.requireAction(Action.ADD);
    ds = mdc.getDocumentReader().getDocuments(new MongoQuery(q.toJson()), 3);
    if(ds.size()!=1) {
      fail("Should have gotten a document back for ADD...");
    }
   
    if(ds.get(0).getAction() != Action.ADD || !ds.get(0).getContentField("name").equals(test.getContentField("name"))) {
View Full Code Here

      fail("Didn't get the correct document for ADD...");
    }

    q = new LocalQuery();
    q.requireAction(Action.DELETE);
    ds = mdc.getDocumentReader().getDocuments(new MongoQuery(q.toJson()), 3);
    if(ds.size()!=1) {
      fail("Should have gotten a document back for DELETE...");
    }
  }
View Full Code Here

  @Test
  public void testFromJSON() throws JsonException {
    MongoConnector mdc = mongoConnectorResource.getConnector();
    LocalQuery q = new LocalQuery();
    MongoQuery mdq = new MongoQuery();
    mdq.fromJson(q.toJson());
    if(mdq.toDBObject().keySet().size()!=0) {
      fail("Expected query to be empty");
    }
   
    q.requireContentFieldExists("name");
View Full Code Here

    if(mdq.toDBObject().keySet().size()!=0) {
      fail("Expected query to be empty");
    }
   
    q.requireContentFieldExists("name");
    mdq.fromJson(q.toJson());
    if(mdq.toDBObject().keySet().size()!=1) {
      fail("Expected query to have one value");
    }
    List<DatabaseDocument<MongoType>> list = mdc.getDocumentReader().getDocuments(mdq, 142);
    if(list.size()!=2) {
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.