Search in sources :

Example 1 with MongodServer

use of com.torodb.mongodb.core.MongodServer in project torodb by torodb.

the class BDDOplogTest method execute.

@Override
public void execute(OplogTestContext context) throws Exception {
    MongodServer server = context.getMongodServer();
    try (MongodConnection conn = server.openConnection()) {
        try (WriteMongodTransaction trans = conn.openWriteTransaction(true)) {
            given(trans);
            trans.commit();
        }
    }
    context.apply(streamOplog(), getApplierContext());
    try (MongodConnection conn = server.openConnection()) {
        try (ReadOnlyMongodTransaction trans = conn.openReadOnlyTransaction()) {
            then(trans);
        }
    }
}
Also used : WriteMongodTransaction(com.torodb.mongodb.core.WriteMongodTransaction) ReadOnlyMongodTransaction(com.torodb.mongodb.core.ReadOnlyMongodTransaction) MongodConnection(com.torodb.mongodb.core.MongodConnection) MongodServer(com.torodb.mongodb.core.MongodServer)

Example 2 with MongodServer

use of com.torodb.mongodb.core.MongodServer in project torodb by torodb.

the class OplogTestContextResourceRule method before.

@Override
protected void before() throws Throwable {
    testInjector = Guice.createInjector(new ReplTestModule(), new TorodServerTestModule(), new CoreModule(), new BackendModule(), new DerbyBackendModule(), new MetainfModule(), new D2RModule(), new MemoryTorodModule(), new MetricsModule(new MetricsConfig() {

        @Override
        public Boolean getMetricsEnabled() {
            return true;
        }
    }), new ConcurrentModule(), new MongoLayerModule(), new MongodServerTestModule(), specificModuleSupplier.get());
    torodServer = testInjector.getInstance(TorodBundle.class).getTorodServer();
    torodServer.startAsync();
    mongodServer = testInjector.getInstance(MongodServer.class);
    mongodServer.startAsync();
    mongodServer.awaitRunning();
    assert mongodServer.getTorodServer().equals(torodServer);
    torodServer.awaitRunning();
    oplogManager = testInjector.getInstance(OplogManager.class);
    oplogManager.startAsync();
    oplogManager.awaitRunning();
    aobe = testInjector.getInstance(AnalyzedOplogBatchExecutor.class);
    aobe.startAsync();
    aobe.awaitRunning();
    oplogApplier = testInjector.getInstance(OplogApplier.class);
    testContext = new DefaultOplogTestContext(mongodServer, oplogApplier);
}
Also used : AnalyzedOplogBatchExecutor(com.torodb.mongodb.repl.oplogreplier.batch.AnalyzedOplogBatchExecutor) MongoLayerModule(com.torodb.mongodb.guice.MongoLayerModule) D2RModule(com.torodb.d2r.guice.D2RModule) OplogManager(com.torodb.mongodb.repl.OplogManager) ConcurrentModule(com.torodb.concurrent.guice.ConcurrentModule) MetricsConfig(com.torodb.core.metrics.MetricsConfig) MetricsModule(com.torodb.core.metrics.guice.MetricsModule) CoreModule(com.torodb.core.guice.CoreModule) BackendModule(com.torodb.backend.guice.BackendModule) DerbyBackendModule(com.torodb.backend.derby.guice.DerbyBackendModule) MetainfModule(com.torodb.metainfo.guice.MetainfModule) MongodServer(com.torodb.mongodb.core.MongodServer) MemoryTorodModule(com.torodb.torod.guice.MemoryTorodModule) DerbyBackendModule(com.torodb.backend.derby.guice.DerbyBackendModule)

Aggregations

MongodServer (com.torodb.mongodb.core.MongodServer)2 DerbyBackendModule (com.torodb.backend.derby.guice.DerbyBackendModule)1 BackendModule (com.torodb.backend.guice.BackendModule)1 ConcurrentModule (com.torodb.concurrent.guice.ConcurrentModule)1 CoreModule (com.torodb.core.guice.CoreModule)1 MetricsConfig (com.torodb.core.metrics.MetricsConfig)1 MetricsModule (com.torodb.core.metrics.guice.MetricsModule)1 D2RModule (com.torodb.d2r.guice.D2RModule)1 MetainfModule (com.torodb.metainfo.guice.MetainfModule)1 MongodConnection (com.torodb.mongodb.core.MongodConnection)1 ReadOnlyMongodTransaction (com.torodb.mongodb.core.ReadOnlyMongodTransaction)1 WriteMongodTransaction (com.torodb.mongodb.core.WriteMongodTransaction)1 MongoLayerModule (com.torodb.mongodb.guice.MongoLayerModule)1 OplogManager (com.torodb.mongodb.repl.OplogManager)1 AnalyzedOplogBatchExecutor (com.torodb.mongodb.repl.oplogreplier.batch.AnalyzedOplogBatchExecutor)1 MemoryTorodModule (com.torodb.torod.guice.MemoryTorodModule)1