Example #1
0
        /// <summary>
        /// usage: integration tests
        /// </summary>
        private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin, string dataDirectory = null, bool singleNodeReplSet = false, string additionalMongodArguments = null,
                              ushort singleNodeReplSetWaitTimeout = MongoDbDefaults.SingleNodeReplicaSetWaitTimeout)
        {
            _fileSystem = fileSystem;
            _port       = portPool.GetNextOpenPort();
            _mongoBin   = mongoBin;

            if (dataDirectory == null)
            {
                dataDirectory = CreateTemporaryDataDirectory();
            }

            MakeMongoBinarysExecutable();

            ConnectionString = singleNodeReplSet
                ? "mongodb://127.0.0.1:{0}/?connect=direct&replicaSet=singleNodeReplSet&readPreference=primary".Formatted(_port)
                : "mongodb://127.0.0.1:{0}/".Formatted(_port);

            _dataDirectoryWithPort = "{0}_{1}".Formatted(dataDirectory, _port);
            _fileSystem.CreateFolder(_dataDirectoryWithPort);
            _fileSystem.DeleteFile("{0}{1}{2}".Formatted(_dataDirectoryWithPort, Path.DirectorySeparatorChar.ToString(), MongoDbDefaults.Lockfile));

            _mongoDbProcess = processStarter.Start(_mongoBin.Directory, _dataDirectoryWithPort, _port, singleNodeReplSet, additionalMongodArguments, singleNodeReplSetWaitTimeout);

            State = State.Running;
        }
Example #2
0
        private static RedisRunner CreateRedisRunner(IPortPool portPool, IRedisProcessStarter processStarter)
        {
            var port = portPool.GetNextOpenPort();

            var redisProcess = processStarter.Start(port);

            return(new RedisRunner(port, redisProcess));
        }
Example #3
0
        private static async Task <RedisRunner> CreateRedisRunnerAsync(
            IPortPool portPool, IRedisProcessStarter processStarter, int timeoutMilliseconds)
        {
            var port = portPool.GetNextOpenPort();

            var redisProcess = await processStarter.StartAsync(port, timeoutMilliseconds)
                               .ConfigureAwait(false);

            return(new RedisRunner(port, redisProcess));
        }
Example #4
0
 public static MongoDbRunner StartUnitTest(
     IPortPool portPool,
     IFileSystem fileSystem,
     IMongoDbProcessStarter processStarter,
     IMongoBinaryLocator mongoBin,
     string dataDirectory = null)
 {
     return(new MongoDbRunner(
                portPool,
                fileSystem,
                processStarter,
                mongoBin,
                dataDirectory));
 }
Example #5
0
        /// <summary>
        /// usage: integration tests
        /// </summary>
        private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter)
        {
            _fileSystem = fileSystem;
            _port       = portPool.GetNextOpenPort();

            ConnectionString = "mongodb://*****:*****@"{0}\{1}".Formatted(_dataDirectoryWithPort, MongoDbDefaults.Lockfile));
            _mongoDbProcess = processStarter.Start(BinariesDirectory, _dataDirectoryWithPort, _port);

            State = State.Running;
        }
Example #6
0
        /// <summary>
        /// usage: integration tests
        /// </summary>
        private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, string dataDirectory)
        {
            _fileSystem = fileSystem;
            _port = portPool.GetNextOpenPort();

            ConnectionString = "mongodb://*****:*****@"{0}\{1}".Formatted(_dataDirectoryWithPort, MongoDbDefaults.Lockfile));
            _mongoDbProcess = processStarter.Start(BinariesDirectory, _dataDirectoryWithPort, _port);

            State = State.Running;
        }
Example #7
0
        /// <summary>
        /// usage: integration tests
        /// </summary>
        private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin, string dataDirectory)
        {
            _fileSystem = fileSystem;
            _port       = portPool.GetNextOpenPort();
            _mongoBin   = mongoBin;

            MakeMongoBinarysExecutable();

            ConnectionString = "mongodb://*****:*****@"{0}{1}{2}".Formatted(_dataDirectoryWithPort, System.IO.Path.DirectorySeparatorChar.ToString(), MongoDbDefaults.Lockfile));

            _mongoDbProcess = processStarter.Start(_mongoBin.Directory, _dataDirectoryWithPort, _port);

            State = State.Running;
        }
Example #8
0
        /// <summary>
        /// usage: integration tests
        /// </summary>
        private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin, string dataDirectory)
        {
            _fileSystem = fileSystem;
            _port = portPool.GetNextOpenPort();
            _mongoBin = mongoBin;

            MakeMongoBinarysExecutable();

            ConnectionString = "mongodb://*****:*****@"{0}{1}{2}".Formatted(_dataDirectoryWithPort, System.IO.Path.DirectorySeparatorChar.ToString(), MongoDbDefaults.Lockfile));

            _mongoDbProcess = processStarter.Start(_mongoBin.Directory, _dataDirectoryWithPort, _port);

            State = State.Running;
        }
Example #9
0
 public static MongoDbRunner StartUnitTest(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin)
 {
     return(new MongoDbRunner(portPool, fileSystem, processStarter, mongoBin, MongoDbDefaults.DataDirectory));
 }
Example #10
0
 internal static MongoDbRunner StartUnitTest(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter)
 {
     return(new MongoDbRunner(portPool, fileSystem, processStarter));
 }
Example #11
0
 public static MongoDbRunner StartUnitTest(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin)
 {
     return new MongoDbRunner(portPool, fileSystem, processStarter, mongoBin, MongoDbDefaults.DataDirectory);
 }
Example #12
0
 internal static MongoDbRunner StartUnitTest(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter)
 {
     return new MongoDbRunner(portPool, fileSystem, processStarter, MongoDbDefaults.DataDirectory);
 }
Example #13
0
 internal static MongoDbRunner StartUnitTest(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter)
 {
     return new MongoDbRunner(portPool, fileSystem, processStarter);
 }