public virtual void Test()
		{
			Assert.Expect(typeof(IncompatibleFileFormatException), new _ICodeBlock_31(this));
			File4.Delete(TempFile());
			IoAdapter adapter = new RandomAccessFileAdapter();
			Assert.IsFalse(adapter.Exists(TempFile()));
		}
		/// <exception cref="System.Exception"></exception>
		public override void SetUp()
		{
			File4.Delete(TempFile());
			IoAdapter adapter = new RandomAccessFileAdapter();
			adapter = adapter.Open(TempFile(), false, 0, false);
			adapter.Write(new byte[] { 1, 2, 3 }, 3);
			adapter.Close();
		}
Ejemplo n.º 3
0
		private void PrepareDbFile(int itemCount)
		{
			Sysout("Preparing DB file ...");
			DeleteFile(_dbFileName);
			Db4objects.Db4o.IO.IoAdapter rafFactory = new RandomAccessFileAdapter();
			Db4objects.Db4o.IO.IoAdapter raf = rafFactory.Open(_dbFileName, false, 0, false);
			LogReplayer replayer = new LogReplayer(CrudApplication.LogFileName(itemCount), raf
				);
			try
			{
				replayer.ReplayLog();
			}
			catch (IOException)
			{
				ExitWithError("Error reading I/O operations log file");
			}
			finally
			{
				raf.Close();
			}
		}
Ejemplo n.º 4
0
		/// <exception cref="NumberFormatException"></exception>
		private Db4objects.Db4o.IO.IoAdapter DelayingIoAdapter(string dbFileName)
		{
			Db4objects.Db4o.IO.IoAdapter rafFactory = new RandomAccessFileAdapter();
			Db4objects.Db4o.IO.IoAdapter delFactory = new Db4objects.Db4o.Bench.Delaying.DelayingIoAdapter
				(rafFactory, _delays);
			return delFactory.Open(dbFileName, false, 0, false);
		}
Ejemplo n.º 5
0
		/// <exception cref="NumberFormatException"></exception>
		/// <exception cref="IOException"></exception>
		/// <exception cref="Db4oIOException"></exception>
		private Db4objects.Db4o.IO.IoAdapter IoAdapter(string dbFileName)
		{
			if (Delayed())
			{
				return DelayingIoAdapter(dbFileName);
			}
			Db4objects.Db4o.IO.IoAdapter rafFactory = new RandomAccessFileAdapter();
			return rafFactory.Open(dbFileName, false, 0, false);
		}
Ejemplo n.º 6
0
		private IConfiguration NewConfiguration(int itemCount)
		{
			RandomAccessFileAdapter rafAdapter = new RandomAccessFileAdapter();
			IoAdapter ioAdapter = new LoggingIoAdapter(rafAdapter, LogFileName(itemCount));
			IConfiguration config = Db4oFactory.NewConfiguration();
			config.Io(ioAdapter);
			return config;
		}