Exemplo n.º 1
0
 public TransactionalIdSystemImpl(IClosure4 freespaceManager, IClosure4 globalIdSystem
     , TransactionalIdSystemImpl parentIdSystem)
 {
     _globalIdSystem = globalIdSystem;
     _slotChanges = new IdSlotChanges(this, freespaceManager);
     _parentIdSystem = parentIdSystem;
 }
Exemplo n.º 2
0
 private object AssertTakeLessThan(long time, IClosure4 runnable)
 {
     var before = Runtime.CurrentTimeMillis();
     var ret = runnable.Run();
     Assert.IsSmallerOrEqual(time, Runtime.CurrentTimeMillis() - before);
     return ret;
 }
Exemplo n.º 3
0
 private object AssertTakeAtLeast(long time, IClosure4 runnable)
 {
     var before = Runtime.CurrentTimeMillis();
     var ret = runnable.Run();
     Assert.IsGreaterOrEqual(time, Runtime.CurrentTimeMillis() - before);
     return ret;
 }
		public TransactionalIdSystemImpl(IClosure4 freespaceManager, IClosure4 globalIdSystem
			, Db4objects.Db4o.Internal.Ids.TransactionalIdSystemImpl parentIdSystem)
		{
			_globalIdSystem = globalIdSystem;
			_slotChanges = new IdSlotChanges(this, freespaceManager);
			_parentIdSystem = parentIdSystem;
		}
			private FailingTestSuite(bool failOnSetup, bool failOnTeardown, BooleanByRef tearDownCalled
				, IClosure4 tests) : base(tests)
			{
				_failOnSetUp = failOnSetup;
				_failOnTeardown = failOnTeardown;
				_tearDownCalled = tearDownCalled;
			}
Exemplo n.º 6
0
 public Object Run(IClosure4 closure)
 {
     lock (this)
     {
         return closure.Run();
     }
 }
Exemplo n.º 7
0
		public virtual object DoWithSlotIndirection(IReadBuffer buffer, ITypeHandler4 typeHandler
			, IClosure4 closure)
		{
			if (!IsIndirectedWithinSlot(typeHandler))
			{
				return closure.Run();
			}
			return DoWithSlotIndirection(buffer, closure);
		}
Exemplo n.º 8
0
		public Object Run(IClosure4 closure4)
        {
			EnterClosure();
            try
            {
                return closure4.Run();
            }
            finally
            {
                AwakeClosure();
            }
        }
Exemplo n.º 9
0
		public virtual object With(object value, IClosure4 block)
		{
			object previous = _value.Get();
			_value.Set(value);
			try
			{
				return block.Run();
			}
			finally
			{
				_value.Set(previous);
			}
		}
Exemplo n.º 10
0
 public static bool Retry(long millisecondsTimeout, int millisecondsBetweenRetries
     , IClosure4 block)
 {
     StopWatch watch = new AutoStopWatch();
     do
     {
         if ((((bool) block.Run())))
         {
             return true;
         }
         Sleep(millisecondsBetweenRetries);
     } while (watch.Peek() < millisecondsTimeout);
     return false;
 }
Exemplo n.º 11
0
		public virtual object DoWithSlotIndirection(IReadBuffer buffer, IClosure4 closure
			)
		{
			int payLoadOffset = buffer.ReadInt();
			buffer.ReadInt();
			// length, not used
			int savedOffset = buffer.Offset();
			object res = null;
			if (payLoadOffset != 0)
			{
				buffer.Seek(payLoadOffset);
				res = closure.Run();
			}
			buffer.Seek(savedOffset);
			return res;
		}
Exemplo n.º 12
0
 /// <exception cref="System.IO.IOException"></exception>
 public static void AssertIndex(string fieldName, string databaseFileName, IClosure4
     configProvider)
 {
     ForceIndex(databaseFileName, ((IEmbeddedConfiguration) configProvider.Run()));
     var defragConfig = new DefragmentConfig(databaseFileName, DefragmentTestCaseBase
         .BackupFileNameFor(databaseFileName));
     defragConfig.Db4oConfig(((IEmbeddedConfiguration) configProvider.Run()));
     Db4o.Defragment.Defragment.Defrag(defragConfig);
     IObjectContainer db = Db4oEmbedded.OpenFile(((IEmbeddedConfiguration) configProvider
         .Run()), databaseFileName);
     var query = db.Query();
     query.Constrain(typeof (Data));
     query.Descend(fieldName).Constrain(Value);
     var result = query.Execute();
     Assert.AreEqual(1, result.Count);
     db.Close();
 }
Exemplo n.º 13
0
 protected override object WithContext(IClosure4 closure)
 {
     return Db4oFixtureVariable.FixtureVariable.With(_fixture, closure);
 }
Exemplo n.º 14
0
		protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests)
		{
			return new Db4oUnit.ClassLevelFixtureTestSuite(_clazz, tests);
		}
Exemplo n.º 15
0
 private SimpleTestSuite(IntByRef counter, int numTests, IClosure4 tests) : base(tests
                                                                                 )
 {
     _counter  = counter;
     _numTests = numTests;
 }
Exemplo n.º 16
0
		public virtual object SyncExec(IClosure4 block)
		{
			lock (_lock)
			{
				CheckClosed();
				return block.Run();
			}
		}
Exemplo n.º 17
0
 public OpaqueTestSuiteBase(IClosure4 tests)
 {
     _tests = tests;
 }
Exemplo n.º 18
0
		public virtual object Run(IClosure4 closure)
		{
			return _current.With(this, closure);
		}
Exemplo n.º 19
0
 private void ConfigureRamFreespaceManager()
 {
     _currentConfig = new _IClosure4_101();
 }
Exemplo n.º 20
0
 public virtual object SyncExec(IClosure4 block)
 {
     return(_server.SyncExec(block));
 }
Exemplo n.º 21
0
 public ClassLevelFixtureTestSuite(Type clazz, IClosure4 tests) : base(tests)
 {
     _clazz = clazz;
 }
Exemplo n.º 22
0
 private void ConfigureBTreeFreespaceManager()
 {
     _currentConfig = new _IClosure4_86();
 }
Exemplo n.º 23
0
 protected virtual object Run(IClosure4 closure4)
 {
     return(CombinedContext().Run(closure4));
 }
Exemplo n.º 24
0
 public virtual object With(object value, IClosure4 closure)
 {
     return(Inject(value).Run(closure));
 }
Exemplo n.º 25
0
 public IdSlotChanges(TransactionalIdSystemImpl idSystem, IClosure4 freespaceManager
                      )
 {
     _idSystem         = idSystem;
     _freespaceManager = freespaceManager;
 }
Exemplo n.º 26
0
 /// <summary>
 /// Can be overriden in inherited classes to inject new fixtures into
 /// the context.
 /// </summary>
 /// <remarks>
 /// Can be overriden in inherited classes to inject new fixtures into
 /// the context.
 /// </remarks>
 /// <param name="closure"></param>
 /// <returns></returns>
 protected virtual object WithContext(IClosure4 closure)
 {
     return(closure.Run());
 }
Exemplo n.º 27
0
 /// <summary>
 ///     Keeps executing a block of code until it either returns true or millisecondsTimeout
 ///     elapses.
 /// </summary>
 /// <remarks>
 ///     Keeps executing a block of code until it either returns true or millisecondsTimeout
 ///     elapses.
 /// </remarks>
 public static bool Retry(long millisecondsTimeout, IClosure4 block)
 {
     return(Retry(millisecondsTimeout, 1, block));
 }
Exemplo n.º 28
0
 protected abstract Db4oUnit.OpaqueTestSuiteBase Transmogrified(IClosure4 tests);
Exemplo n.º 29
0
		public IdSlotChanges(TransactionalIdSystemImpl idSystem, IClosure4 freespaceManager
			)
		{
			_idSystem = idSystem;
			_freespaceManager = freespaceManager;
		}
Exemplo n.º 30
0
		protected virtual object Run(IClosure4 closure4)
		{
			return CombinedContext().Run(closure4);
		}
Exemplo n.º 31
0
			protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests)
			{
				return new OpaqueTestSuiteTestCase.SimpleTestSuite(_counter, _numTests, tests);
			}
 public virtual ITransactionalIdSystem NewTransactionalIdSystem(ITransactionalIdSystem
                                                                systemIdSystem, IClosure4 idSystem)
 {
     return(new TransactionalIdSystemImpl(new _IClosure4_69(this), idSystem, (TransactionalIdSystemImpl
                                                                              )systemIdSystem));
 }
Exemplo n.º 33
0
 protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests)
 {
     return(new SimpleTestSuite(_counter, _numTests, tests));
 }
Exemplo n.º 34
0
		/// <summary>
		/// Can be overriden in inherited classes to inject new fixtures into
		/// the context.
		/// </summary>
		/// <remarks>
		/// Can be overriden in inherited classes to inject new fixtures into
		/// the context.
		/// </remarks>
		/// <param name="closure"></param>
		/// <returns></returns>
		protected virtual object WithContext(IClosure4 closure)
		{
			return closure.Run();
		}
 private void ConfigureBTreeFreespaceManager()
 {
     _currentConfig = new _IClosure4_86();
 }
Exemplo n.º 36
0
			private SimpleTestSuite(IntByRef counter, int numTests, IClosure4 tests) : base(tests
				)
			{
				_counter = counter;
				_numTests = numTests;
			}
Exemplo n.º 37
0
 public static object With(DrsFixture pair, IClosure4 closure)
 {
     return(_variable.With(pair, closure));
 }
Exemplo n.º 38
0
		public ClassLevelFixtureTestSuite(Type clazz, IClosure4 tests) : base(tests)
		{
			_clazz = clazz;
		}
Exemplo n.º 39
0
 protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests)
 {
     return(new OpaqueTestSuiteFailureTestCase.FailingTestSuite(_failOnSetUp, _failOnTeardown
                                                                , _tearDownCalled, tests));
 }
Exemplo n.º 40
0
		public OpaqueTestSuiteBase(IClosure4 tests)
		{
			_tests = tests;
		}
Exemplo n.º 41
0
		protected abstract Db4oUnit.OpaqueTestSuiteBase Transmogrified(IClosure4 tests);
Exemplo n.º 42
0
		public static object With(DrsFixture pair, IClosure4 closure)
		{
			return _variable.With(pair, closure);
		}
		public virtual object SyncExec(IClosure4 block)
		{
			return _server.SyncExec(block);
		}
Exemplo n.º 44
0
 public virtual object Run(IClosure4 closure)
 {
     return(_current.With(this, closure));
 }
Exemplo n.º 45
0
 protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests)
 {
     return(new Db4oUnit.ClassLevelFixtureTestSuite(_clazz, tests));
 }
 private void ConfigureRamFreespaceManager()
 {
     _currentConfig = new _IClosure4_101();
 }
 protected override object WithContext(IClosure4 closure)
 {
     return(Db4oFixtureVariable.FixtureVariable.With(_fixture, closure));
 }
Exemplo n.º 48
0
		public virtual object With(object value, IClosure4 closure)
		{
			return Inject(value).Run(closure);
		}
Exemplo n.º 49
0
 private object WithLock(IClosure4 block)
 {
     if (_stream == null || _stream.IsClosed())
     {
         return block.Run();
     }
     return _stream.SyncExec(block);
 }