public TransactionalIdSystemImpl(IClosure4 freespaceManager, IClosure4 globalIdSystem , TransactionalIdSystemImpl parentIdSystem) { _globalIdSystem = globalIdSystem; _slotChanges = new IdSlotChanges(this, freespaceManager); _parentIdSystem = parentIdSystem; }
private object AssertTakeLessThan(long time, IClosure4 runnable) { var before = Runtime.CurrentTimeMillis(); var ret = runnable.Run(); Assert.IsSmallerOrEqual(time, Runtime.CurrentTimeMillis() - before); return ret; }
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; }
public Object Run(IClosure4 closure) { lock (this) { return closure.Run(); } }
public virtual object DoWithSlotIndirection(IReadBuffer buffer, ITypeHandler4 typeHandler , IClosure4 closure) { if (!IsIndirectedWithinSlot(typeHandler)) { return closure.Run(); } return DoWithSlotIndirection(buffer, closure); }
public Object Run(IClosure4 closure4) { EnterClosure(); try { return closure4.Run(); } finally { AwakeClosure(); } }
public virtual object With(object value, IClosure4 block) { object previous = _value.Get(); _value.Set(value); try { return block.Run(); } finally { _value.Set(previous); } }
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; }
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; }
/// <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(); }
protected override object WithContext(IClosure4 closure) { return Db4oFixtureVariable.FixtureVariable.With(_fixture, closure); }
protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests) { return new Db4oUnit.ClassLevelFixtureTestSuite(_clazz, tests); }
private SimpleTestSuite(IntByRef counter, int numTests, IClosure4 tests) : base(tests ) { _counter = counter; _numTests = numTests; }
public virtual object SyncExec(IClosure4 block) { lock (_lock) { CheckClosed(); return block.Run(); } }
public OpaqueTestSuiteBase(IClosure4 tests) { _tests = tests; }
public virtual object Run(IClosure4 closure) { return _current.With(this, closure); }
private void ConfigureRamFreespaceManager() { _currentConfig = new _IClosure4_101(); }
public virtual object SyncExec(IClosure4 block) { return(_server.SyncExec(block)); }
public ClassLevelFixtureTestSuite(Type clazz, IClosure4 tests) : base(tests) { _clazz = clazz; }
private void ConfigureBTreeFreespaceManager() { _currentConfig = new _IClosure4_86(); }
protected virtual object Run(IClosure4 closure4) { return(CombinedContext().Run(closure4)); }
public virtual object With(object value, IClosure4 closure) { return(Inject(value).Run(closure)); }
public IdSlotChanges(TransactionalIdSystemImpl idSystem, IClosure4 freespaceManager ) { _idSystem = idSystem; _freespaceManager = freespaceManager; }
/// <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()); }
/// <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)); }
protected abstract Db4oUnit.OpaqueTestSuiteBase Transmogrified(IClosure4 tests);
protected virtual object Run(IClosure4 closure4) { return CombinedContext().Run(closure4); }
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)); }
protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests) { return(new SimpleTestSuite(_counter, _numTests, tests)); }
/// <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(); }
public static object With(DrsFixture pair, IClosure4 closure) { return(_variable.With(pair, closure)); }
protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests) { return(new OpaqueTestSuiteFailureTestCase.FailingTestSuite(_failOnSetUp, _failOnTeardown , _tearDownCalled, tests)); }
public static object With(DrsFixture pair, IClosure4 closure) { return _variable.With(pair, closure); }
public virtual object SyncExec(IClosure4 block) { return _server.SyncExec(block); }
public virtual object Run(IClosure4 closure) { return(_current.With(this, closure)); }
protected override OpaqueTestSuiteBase Transmogrified(IClosure4 tests) { return(new Db4oUnit.ClassLevelFixtureTestSuite(_clazz, tests)); }
protected override object WithContext(IClosure4 closure) { return(Db4oFixtureVariable.FixtureVariable.With(_fixture, closure)); }
public virtual object With(object value, IClosure4 closure) { return Inject(value).Run(closure); }
private object WithLock(IClosure4 block) { if (_stream == null || _stream.IsClosed()) { return block.Run(); } return _stream.SyncExec(block); }