示例#1
0
			public _IVisitor4_29(OverlapMap _enclosing, ByRef prevSlot, Sharpen.Util.ISet overlaps
				)
			{
				this._enclosing = _enclosing;
				this.prevSlot = prevSlot;
				this.overlaps = overlaps;
			}
			public _ICodeBlock_34(SaveAsStorageTestCase _enclosing, string oldFileName, ByRef
				 newPath)
			{
				this._enclosing = _enclosing;
				this.oldFileName = oldFileName;
				this.newPath = newPath;
			}
示例#3
0
        public static ByRef NewInstance(object initialValue)
        {
            ByRef instance = new ByRef();

            instance.value = initialValue;
            return(instance);
        }
示例#4
0
		public virtual void TestOnDiscard()
		{
			CacheTestUnit.TestPuppet puppet = new CacheTestUnit.TestPuppet();
			puppet.FillCache();
			ByRef discarded = new ByRef();
			puppet.Produce(42, new _IProcedure4_19(discarded));
			Assert.AreEqual("0", ((string)discarded.value));
		}
示例#5
0
		public ExcludingReflector(ByRef loaderClass, Type[] excludedClasses)
		{
			_excludedClasses = new Collection4();
			for (int claxxIndex = 0; claxxIndex < excludedClasses.Length; ++claxxIndex)
			{
				Type claxx = excludedClasses[claxxIndex];
				_excludedClasses.Add(claxx.FullName);
			}
		}
 public virtual void TestReentrantUpdateThrows()
 {
     var updatedTriggered = new ByRef();
     updatedTriggered.value = false;
     var registry = EventRegistryFactory.ForObjectContainer(Db());
     registry.Updated += new _IEventListener4_102(this, updatedTriggered).OnEvent;
     var items = QueryItemsByName("foo");
     Assert.AreEqual(1, items.Count);
     Assert.IsFalse((((bool) updatedTriggered.value)));
     Store(items.Next());
     Assert.IsTrue((((bool) updatedTriggered.value)));
 }
		//COR-1839
		#if !SILVERLIGHT
		/// <exception cref="System.Exception"></exception>
		public virtual void Test()
		{
			if (!Platform4.HasWeakReferences())
			{
				return;
			}
			WeakReferenceCollectionTestCase.Item item = new WeakReferenceCollectionTestCase.Item
				();
			Store(item);
			Commit();
			ByRef reference = new ByRef();
			ReferenceSystem().TraverseReferences(new _IVisitor4_30(reference));
			Assert.IsNotNull(((ObjectReference)reference.value));
			item = null;
			long timeout = 10000;
			long startTime = Runtime.CurrentTimeMillis();
			while (true)
			{
				long currentTime = Runtime.CurrentTimeMillis();
				if (currentTime - startTime >= timeout)
				{
					Assert.Fail("Timeout waiting for WeakReference collection.");
				}
				Runtime.Gc();
				Runtime.RunFinalization();
				Thread.Sleep(1);
				if (((ObjectReference)reference.value).GetObject() == null)
				{
					break;
				}
			}
			startTime = Runtime.CurrentTimeMillis();
			while (true)
			{
				long currentTime = Runtime.CurrentTimeMillis();
				if (currentTime - startTime >= timeout)
				{
					Assert.Fail("Timeout waiting for removal of ObjectReference from ReferenceSystem."
						);
				}
				BooleanByRef found = new BooleanByRef();
				ReferenceSystem().TraverseReferences(new _IVisitor4_63(reference, found));
				if (!found.value)
				{
					return;
				}
				Thread.Sleep(10);
			}
		}
		/// <exception cref="System.Exception"></exception>
		public virtual void TestReflectField()
		{
			Store(new OldVersionReflectFieldAfterRefactorTestCase.ItemBefore(IdValue));
			Reopen();
			FileSession().StoredClass(typeof(OldVersionReflectFieldAfterRefactorTestCase.ItemBefore
				)).Rename(typeof(OldVersionReflectFieldAfterRefactorTestCase.ItemAfter).FullName
				);
			Reopen();
			ClassMetadata classMetadata = Container().ClassMetadataForName(typeof(OldVersionReflectFieldAfterRefactorTestCase.ItemAfter
				).FullName);
			ByRef originalField = new ByRef();
			classMetadata.TraverseDeclaredFields(new _IProcedure4_37(originalField));
			Assert.AreEqual(typeof(int).FullName, ((FieldMetadata)originalField.value).GetStoredType
				().GetName());
		}
示例#9
0
 public virtual void TestExistingFileWillNotBeOverWritten()
 {
     Db().Store(new Item(1));
     var oldFileName = FileSession().FileName();
     var newPath = new ByRef();
     try
     {
         newPath.value = Path.GetTempFileName();
         Assert.IsTrue(File.Exists(((string) newPath.value)));
         Assert.Expect(typeof (InvalidOperationException), new _ICodeBlock_34(this, oldFileName
             , newPath));
         AssertItems(Db(), 1);
     }
     finally
     {
         File4.Delete(((string) newPath.value));
     }
 }
示例#10
0
 public _IVisitor4_173(ByRef pending)
 {
     this.pending = pending;
 }
示例#11
0
 public _IVisitor4_160(bool[] innerRes, bool isNot, ByRef pending)
 {
     this.innerRes = innerRes;
     this.isNot = isNot;
     this.pending = pending;
 }
		public override void LoadFromClassIndexes(ClassMetadataIterator iter)
		{
			// duplicates because of inheritance hierarchies
			ByRef duplicates = new ByRef();
			while (iter.MoveNext())
			{
				ClassMetadata classMetadata = iter.CurrentClass();
				if (classMetadata.GetName() != null)
				{
					IReflectClass claxx = classMetadata.ClassReflector();
					if (claxx == null || !(Stream()._handlers.IclassInternal.IsAssignableFrom(claxx)))
					{
						IClassIndexStrategy index = classMetadata.Index();
						index.TraverseAll(_transaction, new _IVisitor4_130(this, duplicates));
					}
				}
			}
		}
			public _IEventListener4_102(UpdateInCallbackThrowsTestCase _enclosing, ByRef updatedTriggered
				)
			{
				this._enclosing = _enclosing;
				this.updatedTriggered = updatedTriggered;
			}
示例#14
0
			public _IRunnable_670(ClientObjectContainer _enclosing, Transaction trans, ByRef 
				result)
			{
				this._enclosing = _enclosing;
				this.trans = trans;
				this.result = result;
			}
			public _IVisitor4_63(ByRef reference, BooleanByRef found)
			{
				this.reference = reference;
				this.found = found;
			}
示例#16
0
			public _TraverseFieldCommand_693(string fieldName, ByRef foundField)
			{
				this.fieldName = fieldName;
				this.foundField = foundField;
			}
示例#17
0
		internal virtual object Descend(Transaction trans, object obj, string[] path)
		{
			lock (_lock)
			{
				trans = CheckTransaction(trans);
				ObjectReference @ref = trans.ReferenceForObject(obj);
				if (@ref == null)
				{
					return null;
				}
				string fieldName = path[0];
				if (fieldName == null)
				{
					return null;
				}
				ClassMetadata classMetadata = @ref.ClassMetadata();
				ByRef foundField = new ByRef();
				classMetadata.TraverseAllAspects(new _TraverseFieldCommand_693(fieldName, foundField
					));
				FieldMetadata field = (FieldMetadata)foundField.value;
				if (field == null)
				{
					return null;
				}
				object child = @ref.IsActive() ? field.Get(trans, obj) : DescendMarshallingContext
					(trans, @ref).ReadFieldValue(field);
				if (path.Length == 1)
				{
					return child;
				}
				if (child == null)
				{
					return null;
				}
				string[] subPath = new string[path.Length - 1];
				System.Array.Copy(path, 1, subPath, 0, path.Length - 1);
				return Descend(trans, child, subPath);
			}
		}
			public _IProcedure4_37(ByRef originalField)
			{
				this.originalField = originalField;
			}
			public _IVisitor4_130(IdListQueryResult _enclosing, ByRef duplicates)
			{
				this._enclosing = _enclosing;
				this.duplicates = duplicates;
			}
示例#20
0
 public _IVisitor4_32(ByRef mergedSlot, IList mergedSlots)
 {
     this.mergedSlot = mergedSlot;
     this.mergedSlots = mergedSlots;
 }
示例#21
0
			public _IProcedure4_19(ByRef discarded)
			{
				this.discarded = discarded;
			}
示例#22
0
文件: ByRef.cs 项目: erdincay/db4o
		public static ByRef NewInstance(object initialValue)
		{
			ByRef instance = new ByRef();
			instance.value = initialValue;
			return instance;
		}
示例#23
0
 public _TraverseFieldCommand_1700(ByRef foundField, string fieldName, ClassMetadata
     fieldTypeFilter)
 {
     this.foundField = foundField;
     this.fieldName = fieldName;
     this.fieldTypeFilter = fieldTypeFilter;
 }
			public _IVisitor4_30(ByRef reference)
			{
				this.reference = reference;
			}
示例#25
0
			public _IRunnable_60(ByRef isDaemon)
			{
				this.isDaemon = isDaemon;
			}
示例#26
0
			public _IVisitor4_176(ByRef addressTree)
			{
				this.addressTree = addressTree;
			}
示例#27
0
 public _TraverseFieldCommand_1056(string name, ByRef byReference)
 {
     this.name = name;
     this.byReference = byReference;
 }
		public virtual void TestReentrantUpdateThrows()
		{
			ByRef updatedTriggered = new ByRef();
			updatedTriggered.value = false;
			IEventRegistry registry = EventRegistryFactory.ForObjectContainer(Db());
			registry.Updated += new System.EventHandler<Db4objects.Db4o.Events.ObjectInfoEventArgs>
				(new _IEventListener4_102(this, updatedTriggered).OnEvent);
			IObjectSet items = QueryItemsByName("foo");
			Assert.AreEqual(1, items.Count);
			Assert.IsFalse((((bool)updatedTriggered.value)));
			Store(items.Next());
			Assert.IsTrue((((bool)updatedTriggered.value)));
		}
示例#29
0
		public ExcludingReflector(ByRef loaderClass, Collection4 excludedClasses)
		{
			_excludedClasses = excludedClasses;
		}
示例#30
0
			public _IEventListener4_20(Exception exception, ByRef executed)
			{
				this.exception = exception;
				this.executed = executed;
			}
示例#31
0
			public _IVisitor4_107(ByRef ids)
			{
				this.ids = ids;
			}