Start() 공개 메소드

public Start ( ) : void
리턴 void
예제 #1
0
		public void CanGetFullUrlWithSlashOnTheEnd()
		{
			using (var store = NewDocumentStore())
			using (var server = new HttpServer(store.Configuration, store.DocumentDatabase))
			{
				server.Start();
				var documentStore = new DocumentStore
				{
					Url = "http://localhost:8080/"
				}.Initialize();

				var session = documentStore.OpenSession();

				var entity = new LinqIndexesFromClient.User();
				session.Store(entity);

				Assert.Equal("http://localhost:8080/docs/users/1",
					session.Advanced.GetDocumentUrl(entity));

			}
		}
예제 #2
0
        private void StartTheServer()
        {
            try
            {
                var ravenConfiguration = new RavenConfiguration
                {
                    AnonymousUserAccessMode = AnonymousUserAccessMode.All,
                    Port = _endPoint.Port,
                    ListenerProtocol = ListenerProtocol.Tcp,
                    DataDirectory = _ravenDrivePath
                };

                _documentDatabase = new DocumentDatabase(ravenConfiguration);
                _documentDatabase.SpinBackgroundWorkers();

                _ravenHttpServer = new HttpServer(ravenConfiguration, _documentDatabase);
                _ravenHttpServer.Start();
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
        }
예제 #3
0
        public void CanProjectFromIndex()
        {
            using (var documentStore = NewDocumentStore())
            using (var httpServer = new HttpServer(documentStore.Configuration, documentStore.DocumentDatabase))
            {
                httpServer.Start();
                documentStore.DatabaseCommands.PutIndex("ImagesByTag",
                                                        new IndexDefinition<Image, ImageByTagSearchModel>
                                                        {
                                                            Map = images => from image in images
                                                                        from tag in image.Tags
                                                                        select new 
                                                                        {
                                                                            TagName = tag,
                                                                            Images = new[] { image.Id }
                                                                        },
                                                            Reduce = results => from result in results
                                                                                group result by result.TagName
                                                                                into g
                                                                                select new
                                                                                {
                                                                                    TagName = g.Key,
                                                                                    Images = g.SelectMany(x => x.Images).Distinct()
                                                                                },
                                                            Stores =

                                                                {
                                                                    {x => x.TagName, FieldStorage.Yes},
                                                                    {x => x.Images, FieldStorage.Yes}
                                                                }
                                                            ,
                                                            Indexes =

                                                                {
                                                                    {x => x.TagName, FieldIndexing.NotAnalyzed},
                                                                    {x => x.Images, FieldIndexing.No}
                                                                }
                                                        },true);

                using(var s = documentStore.OpenSession())
                {
                    s.Store(new Image
                    {
                        Id = "images/123",
                        Tags = new[]
                        {
                            "sport", "footbool"
                        }
                    });

                    s.Store(new Image
                    {
                        Id = "images/234",
                        Tags = new[]
                        {
                            "footbool", "live"
                        }
                    });

                    s.SaveChanges();
                }

                using (var s = documentStore.OpenSession())
                {
                    var imageByTagSearchModels = s.Advanced.LuceneQuery<ImageByTagSearchModel>("ImagesByTag")
                        .OrderBy("TagName")
                        .WaitForNonStaleResults()
                        .ToList();

                    Assert.Equal("footbool", imageByTagSearchModels[0].TagName);
                    Assert.Equal(2, imageByTagSearchModels[0].Images.Length);

                    Assert.Equal("live", imageByTagSearchModels[1].TagName);
                    Assert.Equal(1, imageByTagSearchModels[1].Images.Length);

                    Assert.Equal("sport", imageByTagSearchModels[2].TagName);
                    Assert.Equal(1, imageByTagSearchModels[2].Images.Length);
                }
            }
        }