/// <exception cref="System.Exception"></exception> public virtual void SetUp() { IServerConfiguration serverConfiguration = Db4oClientServer.NewServerConfiguration (); serverConfiguration.File.Storage = new MemoryStorage(); _server = Db4oClientServer.OpenServer(serverConfiguration, string.Empty, Db4oClientServer .ArbitraryPort).Ext(); _server.GrantAccess(Username, Password); _networkingClient = Db4oClientServer.OpenClient("localhost", _server.Port(), Username , Password).Ext(); this._embeddedClient = ((ObjectContainerSession)_server.OpenClient().Ext()); }
public virtual Transaction Acquire(string fileName) { lock (_mainContainer.Lock()) { ClientTransactionPool.ContainerCount entry = (ClientTransactionPool.ContainerCount )_fileName2Container.Get(fileName); if (entry == null) { LocalObjectContainer container = (LocalObjectContainer)Db4oEmbedded.OpenFile(Db4oEmbedded .NewConfiguration(), fileName); container.ConfigImpl.SetMessageRecipient(_mainContainer.ConfigImpl.MessageRecipient ()); entry = new ClientTransactionPool.ContainerCount(container); _fileName2Container.Put(fileName, entry); } Transaction transaction = entry.NewTransaction(); ObjectContainerSession objectContainerSession = new ObjectContainerSession(entry. Container(), transaction); transaction.SetOutSideRepresentation(objectContainerSession); _transaction2Container.Put(transaction, entry); return transaction; } }
public virtual void TestClose() { Transaction trans = null; lock (_server.Lock()) { trans = _server.NewUserTransaction(); } IReferenceSystem referenceSystem = trans.ReferenceSystem(); ObjectContainerSession client = new ObjectContainerSession(_server, trans); // FIXME: Need to unregister reference system also // for crashed clients that never get closed. client.Close(); // should have been removed on close. bool wasNotRemovedYet = _server.ReferenceSystemRegistry().RemoveReferenceSystem(referenceSystem ); Assert.IsFalse(wasNotRemovedYet); }