public When_Using_Multiple_Unsharded_Servers() { port1 = 8080; port2 = 8081; path1 = GetPath("TestUnshardedDb1"); path2 = GetPath("TestUnshardedDb2"); RavenDbServer.EnsureCanListenToWhenInNonAdminContext(port1); RavenDbServer.EnsureCanListenToWhenInNonAdminContext(port2); }
public void Execute() { var tempFileName = Path.GetTempFileName(); File.Delete(tempFileName); try { RavenDbServer.EnsureCanListenToWhenInNonAdminContext(testPort); using (var ravenDbServer = new RavenDbServer(new RavenConfiguration { DataDirectory = tempFileName, Port = testPort, AnonymousUserAccessMode = AnonymousUserAccessMode.All, RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true })) { using (var zipFile = new ZipFile(file)) { var zipEntries = zipFile.OfType <ZipEntry>() .Where(x => x.Name.StartsWith("raw/")) .Where(x => Path.GetExtension(x.Name) == ".txt") .GroupBy(x => x.Name.Split('_').First()) .Select(x => new { Request = x.First(), Response = x.Last() }) .ToArray(); foreach (var pair in zipEntries) { // wait until we are finished executing // make scenario executing predictable while (ravenDbServer.Database.HasTasks) { Thread.Sleep(50); } TestSingleRequest( new StreamReader(zipFile.GetInputStream(pair.Request)).ReadToEnd(), zipFile.GetInputStream(pair.Response).ReadData() ); } } } } finally { Directory.Delete(tempFileName, true); } }
private static void LoadIntoRaven() { const string dataDirectory = @"C:\Work\ravendb\ETL\Raven.StackOverflow.Etl\bin\Debug\Data"; if (Directory.Exists(dataDirectory)) { Directory.Delete(dataDirectory, true); } RavenDbServer.EnsureCanListenToWhenInNonAdminContext(9090); using (var ravenDbServer = new RavenDbServer(new RavenConfiguration { DataDirectory = dataDirectory, Port = 9090, AnonymousUserAccessMode = AnonymousUserAccessMode.All })) { ExecuteAndWaitAll( LoadDataFor("Users*.json") //,LoadDataFor("Posts*.json") ); ExecuteAndWaitAll( LoadDataFor("Badges*.json") //,LoadDataFor("Votes*.json"), //LoadDataFor("Comments*.json") ); var indexing = Stopwatch.StartNew(); Console.WriteLine("Waiting for indexing"); while (ravenDbServer.Database.HasTasks) { Console.Write("."); Thread.Sleep(50); } Console.WriteLine(); Console.WriteLine("Finishing indexing took: {0}", indexing.Elapsed); } foreach (var duration in durations.GroupBy(x => x.Item1)) { Console.WriteLine("{0} {1}", duration.Key, duration.Average(x => x.Item2.TotalMilliseconds)); } }
public When_Using_Sharded_Servers() { server = "localhost"; port1 = 8080; port2 = 8081; path1 = GetPath("TestShardedDb1"); path2 = GetPath("TestShardedDb2"); RavenDbServer.EnsureCanListenToWhenInNonAdminContext(port1); RavenDbServer.EnsureCanListenToWhenInNonAdminContext(port2); company1 = new Company { Name = "Company1" }; company2 = new Company { Name = "Company2" }; server1 = GetNewServer(port1, path1); server2 = GetNewServer(port2, path2); shards = new Shards { new DocumentStore { Identifier = "Shard1", Url = "http://" + server + ":" + port1 }, new DocumentStore { Identifier = "Shard2", Url = "http://" + server + ":" + port2 } }; shardSelection = MockRepository.GenerateStub <IShardSelectionStrategy>(); shardSelection.Stub(x => x.ShardIdForNewObject(company1)).Return("Shard1"); shardSelection.Stub(x => x.ShardIdForNewObject(company2)).Return("Shard2"); shardResolution = MockRepository.GenerateStub <IShardResolutionStrategy>(); shardStrategy = MockRepository.GenerateStub <IShardStrategy>(); shardStrategy.Stub(x => x.ShardSelectionStrategy).Return(shardSelection); shardStrategy.Stub(x => x.ShardResolutionStrategy).Return(shardResolution); }
public IDocumentStore CreateStore() { var port = PortRangeStart + servers.Count; RavenDbServer.EnsureCanListenToWhenInNonAdminContext(port); var ravenDbServer = new RavenDbServer(new RavenConfiguration { AnonymousUserAccessMode = AnonymousUserAccessMode.All, Catalog = { Catalogs = { new AssemblyCatalog(typeof(replication::Raven.Bundles.Replication.Triggers.AncestryPutTrigger).Assembly) } }, DataDirectory = "Data #" + servers.Count, RunInUnreliableYetFastModeThatIsNotSuitableForProduction = true, Port = port }); servers.Add(ravenDbServer); var documentStore = new DocumentStore { Url = ravenDbServer.Database.Configuration.ServerUrl }; documentStore.Initialise(); stores.Add(documentStore); return(documentStore); }
public TotalCountServerTest() { port = 8080; path = GetPath("TestDb"); RavenDbServer.EnsureCanListenToWhenInNonAdminContext(8080); }
public DocumentStoreServerTests() { port = 8080; path = GetPath("TestDb"); RavenDbServer.EnsureCanListenToWhenInNonAdminContext(8080); }
public When_Using_Parallel_Access_Strategy() { port = 8080; path = GetPath("TestDb"); RavenDbServer.EnsureCanListenToWhenInNonAdminContext(8080); }