static void Main(string[] args) { var options = new PullReplicationDriverOptions(new Uri("http://localhost:4985")); // Walrus var testStrategy = new DefaultPullReplicationTestStrategy(username: "******", password: "******"); int amountOfDrivers = 1; Console.WriteLine(String.Format("Starting {0} pull replication drivers..", amountOfDrivers)); var metricsTask = Task.WhenAll( Enumerable.Range(0, amountOfDrivers) .Select(_ => new PullReplicationDriver(options)) .Select(driver => Task.Run(() => driver.Start(testStrategy) ) ) .ToArray() ); double avg = metricsTask.Result.Sum(metric => metric.ElapsedMilliseconds) / metricsTask.Result.Count(); foreach (var metric in metricsTask.Result) { Console.WriteLine(metric.ErrorMessage); } Console.WriteLine(String.Format("Pull replication average: {0}", avg)); }
static void Main(string[] args) { var cmdArgs = new CommandLineArgs(); var optionSet = new OptionSet { { "output=", "", path => cmdArgs.DriverOutputFilePath = path }, { "remote=", "", uri => cmdArgs.RemoteUri = new Uri(uri) }, { "spec=", "", path => cmdArgs.JsonDriverSpecPath = path }, { "name=", "", name => cmdArgs.DriverTestName = name }, { "username="******"", username => cmdArgs.Username = username }, { "password="******"", password => cmdArgs.Password = password } } .Parse(args); var testStrategy = new JsonSpecReplicationTestStrategy.Builder() .UseCredentials(cmdArgs.Username, cmdArgs.Password) .WithName(cmdArgs.DriverTestName) .ContinousReplication(true) .Build(); var options = new PullReplicationDriverOptions(remoteUri: cmdArgs.RemoteUri); var driver = new PullReplicationDriver(options); var result = driver.Start(testStrategy); File.WriteAllText( cmdArgs.DriverOutputFilePath, JsonConvert.SerializeObject( new { elapsedMs = result.ElapsedMilliseconds, error = result.Error, errorMessage = result.ErrorMessage, errorDetails = result.ErrorDetails, name = result.TestStrategy.Name, dbDirectory = result.DbDirectory, attachmentStorePath = result.AttachmentStorePath }, Formatting.Indented ) ); }