}
@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();
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"))) {
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...");
}
}