Search in sources :

Example 1 with DocumentStoreFixture

use of org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture in project jackrabbit-oak by apache.

the class MongoCacheConsistencyTest method getFixture.

@Override
public DocumentStoreFixture getFixture() throws Exception {
    Fongo fongo = new OakFongo("fongo") {

        private String suppressedEx = null;

        @Override
        protected void afterInsert(WriteResult result) {
            maybeThrow();
        }

        @Override
        protected void afterFindAndModify(DBObject result) {
            maybeThrow();
        }

        @Override
        protected void afterUpdate(WriteResult result) {
            maybeThrow();
        }

        @Override
        protected void afterRemove(WriteResult result) {
            maybeThrow();
        }

        @Override
        protected void beforeExecuteBulkWriteOperation(boolean ordered, Boolean bypassDocumentValidation, List<?> writeRequests, WriteConcern aWriteConcern) {
            // suppress potentially set exception message because
            // fongo bulk writes call other update methods
            suppressedEx = exceptionMsg;
            exceptionMsg = null;
        }

        @Override
        protected void afterExecuteBulkWriteOperation(BulkWriteResult result) {
            exceptionMsg = suppressedEx;
            suppressedEx = null;
            maybeThrow();
        }

        private void maybeThrow() {
            if (exceptionMsg != null) {
                throw new MongoException(exceptionMsg);
            }
        }
    };
    DocumentMK.Builder builder = provider.newBuilder().setAsyncDelay(0);
    final DocumentStore store = new MongoDocumentStore(fongo.getMongo(), "oak", builder);
    return new DocumentStoreFixture() {

        @Override
        public String getName() {
            return "MongoDB";
        }

        @Override
        public DocumentStore createDocumentStore(DocumentMK.Builder builder) {
            return store;
        }
    };
}
Also used : Fongo(com.github.fakemongo.Fongo) OakFongo(com.mongodb.OakFongo) MongoException(com.mongodb.MongoException) DocumentMK(org.apache.jackrabbit.oak.plugins.document.DocumentMK) OakFongo(com.mongodb.OakFongo) DBObject(com.mongodb.DBObject) BulkWriteResult(com.mongodb.BulkWriteResult) DocumentStore(org.apache.jackrabbit.oak.plugins.document.DocumentStore) WriteResult(com.mongodb.WriteResult) BulkWriteResult(com.mongodb.BulkWriteResult) DocumentStoreFixture(org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture) WriteConcern(com.mongodb.WriteConcern) List(java.util.List)

Example 2 with DocumentStoreFixture

use of org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture in project jackrabbit-oak by apache.

the class RDBCacheConsistencyTest method fixtures.

protected static Collection<Object[]> fixtures(boolean multi) {
    Collection<Object[]> result = new ArrayList<Object[]>();
    DocumentStoreFixture[] candidates = new DocumentStoreFixture[] { DocumentStoreFixture.RDB_H2, DocumentStoreFixture.RDB_DERBY, DocumentStoreFixture.RDB_PG, DocumentStoreFixture.RDB_DB2, DocumentStoreFixture.RDB_MYSQL, DocumentStoreFixture.RDB_ORACLE, DocumentStoreFixture.RDB_MSSQL };
    for (DocumentStoreFixture dsf : candidates) {
        if (dsf.isAvailable()) {
            if (!multi || dsf.hasSinglePersistence()) {
                result.add(new Object[] { dsf });
            }
        }
    }
    return result;
}
Also used : DocumentStoreFixture(org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture) ArrayList(java.util.ArrayList)

Example 3 with DocumentStoreFixture

use of org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture in project jackrabbit-oak by apache.

the class RDBDocumentStoreSchemaUpgradeTest method fixtures.

@Parameterized.Parameters(name = "{0}")
public static java.util.Collection<Object[]> fixtures() {
    java.util.Collection<Object[]> result = new ArrayList<Object[]>();
    DocumentStoreFixture[] candidates = new DocumentStoreFixture[] { DocumentStoreFixture.RDB_H2, DocumentStoreFixture.RDB_DERBY, DocumentStoreFixture.RDB_PG, DocumentStoreFixture.RDB_DB2, DocumentStoreFixture.RDB_MYSQL, DocumentStoreFixture.RDB_ORACLE, DocumentStoreFixture.RDB_MSSQL };
    for (DocumentStoreFixture dsf : candidates) {
        if (dsf.isAvailable()) {
            result.add(new Object[] { dsf });
        }
    }
    return result;
}
Also used : DocumentStoreFixture(org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture) ArrayList(java.util.ArrayList)

Aggregations

DocumentStoreFixture (org.apache.jackrabbit.oak.plugins.document.DocumentStoreFixture)3 ArrayList (java.util.ArrayList)2 Fongo (com.github.fakemongo.Fongo)1 BulkWriteResult (com.mongodb.BulkWriteResult)1 DBObject (com.mongodb.DBObject)1 MongoException (com.mongodb.MongoException)1 OakFongo (com.mongodb.OakFongo)1 WriteConcern (com.mongodb.WriteConcern)1 WriteResult (com.mongodb.WriteResult)1 List (java.util.List)1 DocumentMK (org.apache.jackrabbit.oak.plugins.document.DocumentMK)1 DocumentStore (org.apache.jackrabbit.oak.plugins.document.DocumentStore)1