How to create custom db, opensession for custom db in test

53 views
Skip to first unread message

borgez

unread,
Dec 15, 2017, 8:29:06 AM12/15/17
to RavenDB - 2nd generation document database
it failed Raven.Abstractions.Connection.ErrorResponseException : Could not find a resource named: testdb2

i use EmbeddableDocumentStore in test

Oren Eini (Ayende Rahien)

unread,
Dec 15, 2017, 9:53:21 AM12/15/17
to ravendb
What version are you using?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Fri, Dec 15, 2017 at 3:29 PM, borgez <alli...@gmail.com> wrote:
it failed Raven.Abstractions.Connection.ErrorResponseException : Could not find a resource named: testdb2

i use EmbeddableDocumentStore in test

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

borgez

unread,
Dec 22, 2017, 9:02:40 PM12/22/17
to RavenDB - 2nd generation document database

3.5.4



пятница, 15 декабря 2017 г., 17:53:21 UTC+3 пользователь Oren Eini написал:
What version are you using?

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


On Fri, Dec 15, 2017 at 3:29 PM, borgez <alli...@gmail.com> wrote:
it failed Raven.Abstractions.Connection.ErrorResponseException : Could not find a resource named: testdb2

i use EmbeddableDocumentStore in test

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Dec 23, 2017, 2:25:46 PM12/23/17
to ravendb
Please provide a failing test case
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Dec 23, 2017, 2:26:24 PM12/23/17
to ravendb

borgez

unread,
Dec 25, 2017, 6:30:16 AM12/25/17
to RavenDB - 2nd generation document database
Raven.Abstractions.Connection.ErrorResponseException : Could not find a resource named: test1
   в Raven.Client.Connection.Implementation.HttpJsonRequest.<CheckForErrorsAndReturnCachedResultIfAnyAsync>d__41.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Connection\Implementation\HttpJsonRequest.cs:строка 495
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Raven.Client.Connection.Implementation.HttpJsonRequest.<>c__DisplayClass36_0.<<SendRequestInternal>b__0>d.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Connection\Implementation\HttpJsonRequest.cs:строка 268
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Raven.Client.Connection.Implementation.HttpJsonRequest.<RunWithAuthRetry>d__38`1.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Connection\Implementation\HttpJsonRequest.cs:строка 314
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Raven.Client.Connection.Implementation.HttpJsonRequest.<ReadResponseJsonAsync>d__35.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Connection\Implementation\HttpJsonRequest.cs:строка 221
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Raven.Client.Connection.Async.AsyncServerClient.<DirectGetAsync>d__78.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Connection\Async\AsyncServerClient.cs:строка 966
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Raven.Client.Connection.ReplicationInformerBase`1.<TryOperationAsync>d__34`1.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Connection\ReplicationInformerBase.cs:строка 421
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Raven.Client.Connection.ReplicationInformerBase`1.<ExecuteWithReplicationAsync>d__33`1.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Connection\ReplicationInformerBase.cs:строка 316
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Raven.Client.Connection.Async.AsyncServerClient.<ExecuteWithReplication>d__172`1.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Connection\Async\AsyncServerClient.cs:строка 0
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в Raven.Abstractions.Util.AsyncHelpers.<>c__DisplayClass1_1`1.<<RunSync>b__0>d.MoveNext() в C:\Builds\RavenDB-Stable-3.5\Raven.Abstractions\Util\AsyncHelpers.cs:строка 75
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в Raven.Abstractions.Util.AsyncHelpers.RunSync[T](Func`1 task) в C:\Builds\RavenDB-Stable-3.5\Raven.Abstractions\Util\AsyncHelpers.cs:строка 89
   в Raven.Client.Document.HiLoKeyGenerator.GetDocument(IDatabaseCommands databaseCommands) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:строка 173
   в Raven.Client.Document.HiLoKeyGenerator.GetNextRange(IDatabaseCommands databaseCommands) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:строка 95
   в Raven.Client.Document.HiLoKeyGenerator.NextId(IDatabaseCommands commands) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\HiLoKeyGenerator.cs:строка 74
   в Raven.Client.Document.MultiTypeHiLoKeyGenerator.GenerateDocumentKey(IDatabaseCommands databaseCommands, DocumentConvention conventions, Object entity) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\MultiTypeHiLoKeyGenerator.cs:строка 61
   в Raven.Client.Document.DocumentStore.<>c__DisplayClass57_0.<Initialize>b__0(String dbName, IDatabaseCommands databaseCommands, Object entity) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\DocumentStore.cs:строка 404
   в Raven.Client.Document.GenerateEntityIdOnTheClient.GetOrGenerateDocumentKey(Object entity) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\GenerateEntityIdOnTheClient.cs:строка 67
   в Raven.Client.Document.GenerateEntityIdOnTheClient.GenerateDocumentKeyForStorage(Object entity) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\GenerateEntityIdOnTheClient.cs:строка 92
   в Raven.Client.Document.InMemoryDocumentSessionOperations.StoreInternal(Object entity, Etag etag, String id, ConcurrencyCheckMode concurrencyCheckMode) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:строка 738
   в Raven.Client.Document.InMemoryDocumentSessionOperations.Store(Object entity) в C:\Builds\RavenDB-Stable-3.5\Raven.Client.Lightweight\Document\InMemoryDocumentSessionOperations.cs:строка 697
   в Loans.Web.BackendTests.SampleTestClass.SampleTestMethod() в C:\source\Tests\Test.cs:строка 23


public class SampleTestClass : RavenTestBase
{

[Test]
public void SampleTestMethod()
{
using (var store = NewDocumentStore())
{
using (var session = store.OpenSession("test1"))
{
session.Store(new Employee());

session.SaveChanges();
}

WaitForIndexing(store);

using (var session = store.OpenSession("test1"))
{
var employees = session
.Query<Employee>() 
.ToList();

Assert.AreEqual(1, employees.Count);
}
}
}

public class Employee
{
}
}

суббота, 23 декабря 2017 г., 22:26:24 UTC+3 пользователь Oren Eini написал:

Oren Eini (Ayende Rahien)

unread,
Dec 25, 2017, 6:38:11 AM12/25/17
to ravendb
Makes perfect sense, you are create a new document store, but it gives you a dedicated db, not a named db.
In general avoid named dbs in tests because they can cause collisions between concurrent tests.

You _can_ create a new db and use it in the test, but it already did it for you
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

borgez

unread,
Dec 25, 2017, 8:34:19 AM12/25/17
to RavenDB - 2nd generation document database
and how test controller like

using (var session = store.OpenSession())
using (var secondDb = store.OpenSession("test1")) // db like external directory which i do not want to keep in the main database

понедельник, 25 декабря 2017 г., 14:38:11 UTC+3 пользователь Oren Eini написал:

borgez

unread,
Dec 25, 2017, 8:35:24 AM12/25/17
to RavenDB - 2nd generation document database
i not found how create db in test in ravendb tests

borgez

unread,
Dec 25, 2017, 8:43:16 AM12/25/17
to RavenDB - 2nd generation document database
it works....
using (var store = NewDocumentStore())
{
store.DatabaseCommands.GlobalAdmin.CreateDatabase(new DatabaseDocument
{
Id = "test1",
Settings = { { "Raven/DataDir", "~/test1" } }
});

Oren Eini (Ayende Rahien)

unread,
Dec 25, 2017, 9:17:32 AM12/25/17
to ravendb
yes

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
Reply all
Reply to author
Forward
0 new messages