Search in sources :

Example 1 with DBEncoder

use of com.mongodb.DBEncoder in project jackrabbit-oak by apache.

the class MongoDBExceptionTest method before.

@Before
public void before() throws Exception {
    OakFongo fongo = new OakFongo("fongo") {

        @Override
        protected void beforeExecuteBulkWriteOperation(boolean ordered, Boolean bypassDocumentValidation, List<?> writeRequests, WriteConcern aWriteConcern) {
            maybeThrow();
        }

        @Override
        protected void beforeFindAndModify(DBObject query, DBObject fields, DBObject sort, boolean remove, DBObject update, boolean returnNew, boolean upsert) {
            maybeThrow();
        }

        @Override
        protected void beforeUpdate(DBObject q, DBObject o, boolean upsert, boolean multi, WriteConcern concern, DBEncoder encoder) {
            maybeThrow();
        }

        @Override
        protected void beforeFind(DBObject query, DBObject projection) {
            maybeThrow();
        }

        private void maybeThrow() {
            if (exceptionMsg != null) {
                throw new MongoException(exceptionMsg);
            }
        }
    };
    store = new MongoDocumentStore(fongo.getMongo(), "oak", new DocumentMK.Builder());
}
Also used : MongoException(com.mongodb.MongoException) WriteConcern(com.mongodb.WriteConcern) OakFongo(com.mongodb.OakFongo) Collections.singletonList(java.util.Collections.singletonList) List(java.util.List) DBEncoder(com.mongodb.DBEncoder) DBObject(com.mongodb.DBObject) Before(org.junit.Before)

Aggregations

DBEncoder (com.mongodb.DBEncoder)1 DBObject (com.mongodb.DBObject)1 MongoException (com.mongodb.MongoException)1 OakFongo (com.mongodb.OakFongo)1 WriteConcern (com.mongodb.WriteConcern)1 Collections.singletonList (java.util.Collections.singletonList)1 List (java.util.List)1 Before (org.junit.Before)1