private ServerMessageDispatcherImpl FirstMessageDispatcherFor(ObjectServerImpl server ) { var dispatchers = server.IterateDispatchers(); Assert.IsTrue(dispatchers.MoveNext()); var msgDispatcher = (ServerMessageDispatcherImpl)dispatchers .Current; return(msgDispatcher); }
/// <exception cref="System.Exception"></exception> public virtual void Test() { IServerConfiguration config = Db4oClientServer.NewServerConfiguration(); config.TimeoutServerSocket = Timeout; config.File.Storage = new MemoryStorage(); ObjectServerImpl server = (ObjectServerImpl)Db4oClientServer.OpenServer(config, string.Empty , Db4oClientServer.ArbitraryPort); Thread.Sleep(Timeout * 2); Assert.AreEqual(0, server.TransactionCount()); server.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void _test() { ObjectServerImpl serverImpl = (ObjectServerImpl)ClientServerFixture().Server(); IEnumerator iter = serverImpl.IterateDispatchers(); iter.MoveNext(); IServerMessageDispatcher serverDispatcher = (IServerMessageDispatcher)iter.Current; IClientMessageDispatcher clientDispatcher = ((ClientObjectContainer)Db()).MessageDispatcher (); clientDispatcher.Close(); Runtime4.Sleep(1000); Assert.IsFalse(serverDispatcher.IsMessageDispatcherAlive()); }
/// <exception cref="System.Exception"></exception> public virtual void Test() { ObjectServerImpl server = (ObjectServerImpl)Db4oClientServer.OpenServer(TempFile( ), Db4oClientServer.ArbitraryPort); Lock4 Lock = new Lock4(); server.ClientDisconnected += new System.EventHandler <Db4objects.Db4o.Events.StringEventArgs> (new _IEventListener4_39(Lock).OnEvent); server.GrantAccess(User, Password); IObjectContainer client = OpenClient(server.Port()); ServerMessageDispatcherImpl msgDispatcher = FirstMessageDispatcherFor(server); Transaction transaction = msgDispatcher.Transaction(); ITransactionalIdSystem idSystem = transaction.IdSystem(); int prefetchedID = idSystem.PrefetchID(); Assert.IsGreater(0, prefetchedID); Lock.Run(new _IClosure4_58(client, Lock, idSystem, prefetchedID)); // This wont work with the PointerBasedIdSystem server.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void Test() { IExtObjectContainer db = Fixture().Db(); ObjectServerImpl serverImpl = (ObjectServerImpl)ClientServerFixture().Server(); try { IEnumerator iter = serverImpl.IterateDispatchers(); iter.MoveNext(); ServerMessageDispatcherImpl serverDispatcher = (ServerMessageDispatcherImpl)iter. Current; serverDispatcher.Socket().Close(); Runtime4.Sleep(1000); Assert.Expect(typeof(DatabaseClosedException), new _ICodeBlock_30(db)); Assert.IsTrue(db.IsClosed()); } finally { serverImpl.Close(); } }
public virtual Msg ReplyFromServer() { lock (ContainerLock()) { string userName = ReadString(); string password = ReadString(); ObjectServerImpl server = ServerMessageDispatcher().Server(); User found = server.GetUser(userName); if (found != null) { if (found.password.Equals(password)) { ServerMessageDispatcher().SetDispatcherName(userName); LogMsg(32, userName); int blockSize = Container().BlockSize(); int encrypt = Container()._handlers.i_encrypt ? 1 : 0; ServerMessageDispatcher().Login(); return(Msg.LoginOk.GetWriterForInts(Transaction(), new int[] { blockSize, encrypt , ServerMessageDispatcher().DispatcherID() })); } } } return(Msg.Failed); }
protected virtual IServerMessageDispatcher ServerDispatcher() { ObjectServerImpl serverImpl = Server(); return((IServerMessageDispatcher)Iterators.Next(serverImpl.IterateDispatchers())); }