Example #1
0
        /// <exception cref="System.Exception"></exception>
        public static void AssertAllSlotsFreed(LocalTransaction trans, BTree bTree, ICodeBlock
                                               block)
        {
            LocalObjectContainer   container  = (LocalObjectContainer)trans.Container();
            ITransactionalIdSystem idSystem   = trans.IdSystem();
            IEnumerator            allSlotIDs = bTree.AllNodeIds(trans.SystemTransaction());
            Collection4            allSlots   = new Collection4();

            while (allSlotIDs.MoveNext())
            {
                int  slotID = ((int)allSlotIDs.Current);
                Slot slot   = idSystem.CurrentSlot(slotID);
                allSlots.Add(slot);
            }
            Slot bTreeSlot = idSystem.CurrentSlot(bTree.GetID());

            allSlots.Add(bTreeSlot);
            Collection4       freedSlots       = new Collection4();
            IFreespaceManager freespaceManager = container.FreespaceManager();

            container.InstallDebugFreespaceManager(new FreespaceManagerForDebug(new _ISlotListener_99
                                                                                    (freedSlots)));
            block.Run();
            container.InstallDebugFreespaceManager(freespaceManager);
            Assert.IsTrue(freedSlots.ContainsAll(allSlots.GetEnumerator()));
        }
Example #2
0
 /// <exception cref="System.Exception"></exception>
 public void Run()
 {
     // This is a magic number:
     // On my machine all tests start to pass when I write at least 7 times.
     // Trying with 20 on the build machine.
     for (var i = 0; i < 20; i++)
     {
         codeBlock.Run();
     }
 }
Example #3
0
 public void Run()
 {
     try
     {
         codeBlock.Run();
     }
     catch (Exception t)
     {
         Runtime.PrintStackTrace(t);
     }
 }
Example #4
0
		private static Exception GetThrowable(ICodeBlock block)
		{
			try
			{
				block.Run();
			}
			catch (Exception e)
			{
				return e;
			}
			return null;
		}
Example #5
0
 private static Exception GetThrowable(ICodeBlock block)
 {
     try
     {
         block.Run();
     }
     catch (Exception e)
     {
         return(e);
     }
     return(null);
 }
		/// <exception cref="System.Exception"></exception>
		public static void AssertAllSlotsFreed(LocalTransaction trans, BTree bTree, ICodeBlock
			 block)
		{
			LocalObjectContainer container = (LocalObjectContainer)trans.Container();
			ITransactionalIdSystem idSystem = trans.IdSystem();
			IEnumerator allSlotIDs = bTree.AllNodeIds(trans.SystemTransaction());
			Collection4 allSlots = new Collection4();
			while (allSlotIDs.MoveNext())
			{
				int slotID = ((int)allSlotIDs.Current);
				Slot slot = idSystem.CurrentSlot(slotID);
				allSlots.Add(slot);
			}
			Slot bTreeSlot = idSystem.CurrentSlot(bTree.GetID());
			allSlots.Add(bTreeSlot);
			Collection4 freedSlots = new Collection4();
			IFreespaceManager freespaceManager = container.FreespaceManager();
			container.InstallDebugFreespaceManager(new FreespaceManagerForDebug(new _ISlotListener_99
				(freedSlots)));
			block.Run();
			container.InstallDebugFreespaceManager(freespaceManager);
			Assert.IsTrue(freedSlots.ContainsAll(allSlots.GetEnumerator()));
		}