You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by mh...@apache.org on 2011/08/05 21:21:29 UTC
[Lucene.Net] svn commit: r1154359 [24/25] - in
/incubator/lucene.net/branches/Lucene.Net_4e: ./ build/ build/scripts/
packages/ packages/Gallio.3.2.750/ packages/Gallio.3.2.750/licenses/
packages/Gallio.3.2.750/tools/ packages/Gallio.3.2.750/tools/NCover/
packages/...
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakKeyReferenceOfT.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakKeyReferenceOfT.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakKeyReferenceOfT.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakKeyReferenceOfT.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,72 @@
+// -----------------------------------------------------------------------
+// <copyright file="WeakKeyReferenceOfT.cs" company="Apache">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Support
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+
+ /// <summary>
+ /// A reference to the weak <c>TKey</c> reference in the <see cref="WeakDictionary{TKey,TValue}"/>
+ /// that will hold reference to the key even if the target is GC'ed (Garbage Collected),
+ /// so that the dictionary can still find the key to remove the dead reference.
+ /// </summary>
+ /// <typeparam name="T">The <typeparamref name="T"/> type.</typeparam>
+ /// <remarks>
+ /// <note>
+ /// <para>
+ /// <b>C# File: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/src/Lucene.Net/Support/WeakKeyReferenceOfT.cs">
+ /// src/Lucene.Net/Support/WeakKeyReferenceOfT.cs
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# Tests: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/test/Lucene.Net.Test/Util/Support/WeakKeyReferenceOfTTest.cs">
+ /// test/Lucene.Net.Test/Support/WeakKeyReferenceOfTTest.cs
+ /// </a>
+ /// </para>
+ /// </note>
+ /// </remarks>
+ internal sealed class WeakKeyReference<T> : WeakReference<T>
+ where T : class
+ {
+ /// <summary>
+ /// The hashcode of the <typeparamref name="T"/> key.
+ /// </summary>
+ public readonly int HashCode;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="WeakKeyReference<T>"/> class.
+ /// </summary>
+ /// <param name="key">The key.</param>
+ /// <param name="comparer">The comparer.</param>
+ public WeakKeyReference(T key, WeakKeyComparer<T> comparer)
+ : base(key)
+ {
+ // retain the object's hash code immediately so that even
+ // if the target is GC'ed we will be able to find and
+ // remove the dead weak reference.
+ this.HashCode = comparer.GetHashCode(key);
+ }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakNullReferenceOfT.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakNullReferenceOfT.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakNullReferenceOfT.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakNullReferenceOfT.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,66 @@
+// -----------------------------------------------------------------------
+// <copyright file="WeakNullReferenceOfT.cs" company="Apache">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Support
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+ /// <summary>
+ /// Represents a weak reference of null for the specified type.
+ /// </summary>
+ /// <typeparam name="T">The type of the target.</typeparam>
+ /// <remarks>
+ /// <note>
+ /// <para>
+ /// <b>C# File: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/src/Lucene.Net/Support/WeakNullReferenceOfT.cs">
+ /// src/Lucene.Net/Support/WeakNullReferenceOfT.cs
+ /// </a>
+ /// </para>
+ /// </note>
+ /// </remarks>
+ public class WeakNullReference<T> : WeakReference<T>
+ where T : class
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="WeakNullReference<T>"/> class.
+ /// </summary>
+ public WeakNullReference()
+ : base(null)
+ {
+ }
+
+ /// <summary>
+ /// Gets an indication whether the object referenced by the current <see cref="T:System.WeakReference"/> object has been garbage collected.
+ /// </summary>
+ /// <value></value>
+ /// <returns>true if the object referenced by the current <see cref="T:System.WeakReference"/> object has not been garbage collected and is still accessible; otherwise, false.</returns>
+ public override bool IsAlive
+ {
+ get
+ {
+ return true;
+ }
+ }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakReferenceOfT.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakReferenceOfT.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakReferenceOfT.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/WeakReferenceOfT.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,87 @@
+// -----------------------------------------------------------------------
+// <copyright file="WeakReferenceOfT.cs" company="Apache">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Support
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+
+ /// <summary>
+ /// Represents a weak reference of <typeparamref name="T"/>, which references an object while still allowing
+ /// that object to be reclaimed by garbage collection.
+ /// </summary>
+ /// <remarks>
+ /// <note>
+ /// <para>
+ /// <b>C# File: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/src/Lucene.Net/Support/WeakReferenceOfT.cs">
+ /// src/Lucene.Net/Support/WeakReferenceOfTTest.cs
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# Tests: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/test/Lucene.Net.Test/Util/Support/WeakReferenceOfTTest.cs">
+ /// test/Lucene.Net.Test/Support/WeakReferenceOfTTest.cs
+ /// </a>
+ /// </para>
+ /// </note>
+ /// <para>
+ /// This was implemented to be the C# equivalent of has a Java WeakReference of T. It should be
+ /// noted that <a href="http://msdn.microsoft.com/en-us/library/gg712832%28v=vs.96%29.aspx">Silverlight 5
+ /// already supports WeakReference of T</a>.
+ /// </para>
+ /// </remarks>
+ /// <typeparam name="T">The <typeparamref name="T"/> type.</typeparam>
+ public class WeakReference<T> : WeakReference
+ where T : class
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="WeakReference<T>"/> class.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ public WeakReference(T target)
+ : base(target)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="WeakReference<T>"/> class.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="trackResurrection">if set to <c>true</c> [track resurrection].</param>
+ public WeakReference(T target, bool trackResurrection)
+ : base(target, trackResurrection)
+ {
+ }
+
+ /// <summary>
+ /// Gets the object (the target) referenced by the current <see cref="T:System.WeakReference"/> object.
+ /// </summary>
+ /// <value></value>
+ /// <returns>null if the object referenced by the current <see cref="T:System.WeakReference"/> object has been garbage collected; otherwise, a reference to the object referenced by the current <see cref="T:System.WeakReference"/> object.</returns>
+ /// <exception cref="T:System.InvalidOperationException">The reference to the target object is invalid. This exception can be thrown while setting this property if the value is a null reference or if the object has been finalized during the set operation.</exception>
+ public new T Target
+ {
+ get { return (T)base.Target; }
+ }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/ArrayUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/ArrayUtil.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/ArrayUtil.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/ArrayUtil.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,114 @@
+// -----------------------------------------------------------------------
+// <copyright company="Apache" file="ArrayUtil.cs">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Util
+{
+ using System;
+
+ /// <summary>
+ /// Utility class for manipulating arrays.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// <b>Java File: </b> <a href="https://github.com/apache/lucene-solr/blob/trunk/lucene/src/java/org/apache/lucene/util/ArrayUtil.java">
+ /// lucene/src/java/org/apache/lucene/util/AttributeUtil.java
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# File: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/src/Lucene.Net/Util/ArrayUtil.cs">
+ /// src/Lucene.Net/Util/ArrayUtil.cs
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# Tests: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/test/Lucene.Net.Test/Util/ArrayUtilTest.cs">
+ /// test/Lucene.Net.Test/Util/ArrayUtilTest.cs
+ /// </a>
+ /// </para>
+ /// </remarks>
+ public static class ArrayUtil
+ {
+ /// <summary>
+ /// Returns an array size that is greater or equal to the <paramref name="minimalTargetSize"/>.
+ /// This will generally over allocate exponentially to achieve amortized
+ /// linear-time cost as the array grows.
+ /// </summary>
+ /// <param name="minimalTargetSize">Size of the minimal target.</param>
+ /// <param name="bytesPerElement">The bytes per element.</param>
+ /// <returns>the size of the array.</returns>
+ public static int Oversize(int minimalTargetSize, int bytesPerElement)
+ {
+ if (minimalTargetSize < 0)
+ throw new ArgumentOutOfRangeException("minimalTargetSize", "the minimalTargetSize must be 0 or greater.");
+
+ if (minimalTargetSize == 0)
+ return minimalTargetSize;
+
+ // asymptotic exponential growth by 1/8th, favors
+ // spending a bit more CPU to not tie up too much wasted RAM
+ int extra = minimalTargetSize >> 3;
+
+ // for very small arrays, where constant overhead of
+ // realloc* is presumably relatively high, we grow faster.
+ // realloc - memory re-allocator.
+ if (extra < 3)
+ extra = 3;
+
+ int newSize = minimalTargetSize * extra;
+
+ if (newSize + 7 < 0)
+ return int.MaxValue;
+
+ if (IntPtr.Size == 8)
+ {
+ switch (bytesPerElement)
+ {
+ case 4:
+ // round up to multiple of 2
+ return (newSize + 1) & 0x7ffffffe;
+
+ case 2:
+ // round up to multiple of 4
+ return (newSize + 3) & 0x7ffffffc;
+
+ case 1:
+ // round up to multiple of 8
+ return (newSize + 7) & 0x7ffffff8;
+
+ default:
+ return newSize;
+ }
+ }
+
+ switch (bytesPerElement)
+ {
+ case 2:
+ // round up to multiple of 4
+ return (newSize + 1) & 0x7ffffffe;
+
+ case 1:
+ // round up to multiple of 8
+ return (newSize + 3) & 0x7ffffffc;
+ default:
+ return newSize;
+ }
+ }
+ }
+}
\ No newline at end of file
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeBase.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeBase.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeBase.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeBase.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,139 @@
+// -----------------------------------------------------------------------
+// <copyright file="AttributeBase.cs" company="Apache">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Util
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Reflection;
+ using System.Text;
+ using Support;
+
+ /// <summary>
+ /// TODO: Update summary.
+ /// </summary>
+ /// <remarks>
+ /// <note>
+ /// <para>
+ /// <b>Java File: </b> <a href="https://github.com/apache/lucene-solr/blob/trunk/lucene/src/java/org/apache/lucene/util/AttributeImpl.java">
+ /// lucene/src/java/org/apache/lucene/util/AttributeImpl.java
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# File: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/src/Lucene.Net/Util/AttributeBase.cs">
+ /// src/Lucene.Net/Util/AttributeBase.cs
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# Tests: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/test/Lucene.Net.Test/Util/AttributeBaseTest.cs">
+ /// test/Lucene.Net.Test/Util/AttributeBaseTest.cs
+ /// </a>
+ /// </para>
+ /// </note>
+ /// </remarks>
+ public abstract class AttributeBase : IAttribute, ICloneable
+ {
+ /// <summary>
+ /// Clears the instance.
+ /// </summary>
+ public abstract void Clear();
+
+ /// <summary>
+ /// Copies to.
+ /// </summary>
+ /// <param name="attributeBase">The attribute base.</param>
+ public abstract void CopyTo(AttributeBase attributeBase);
+
+
+ /// <summary>
+ /// Reflects as string.
+ /// </summary>
+ /// <param name="prependAttributeType">if set to <c>true</c> [prepend attribute type].</param>
+ /// <returns>a <see cref="string"/></returns>
+ public string ReflectAsString(bool prependAttributeType = false)
+ {
+ var buffer = new StringBuilder();
+
+ this.Reflect((type, name, value) =>
+ {
+ if (buffer.Length > 0)
+ buffer.Append(",");
+
+ if (prependAttributeType)
+ buffer.Append(type.Name).Append("#");
+
+ buffer
+ .Append(name)
+ .Append("=")
+ .Append(value == null ? "null" : value.ToString());
+ });
+
+ return buffer.ToString();
+ }
+
+
+
+ /// <summary>
+ /// Reflects the specified reflect action.
+ /// </summary>
+ /// <param name="reflectAction">The reflect action.</param>
+ public virtual void Reflect(Action<Type, string, object> reflectAction)
+ {
+ Type type = this.GetType();
+ LinkedList<WeakReference<Type>> foundInterfaces = AttributeSource.GetAttributeInterfaces(type);
+
+ if (foundInterfaces.Count == 0)
+ return;
+
+ if (foundInterfaces.Count > 1)
+ throw new NotSupportedException(
+ string.Format(
+ "{0} implements more than one attribute interface. " +
+ "The default ReflectWith(IAttributeReflector) implementation can not handle this.",
+ type.FullName));
+
+ PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
+ FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
+
+ foreach (var prop in properties)
+ {
+ reflectAction(type, prop.Name, prop.GetValue(this, null));
+ }
+
+ foreach (var field in fields)
+ {
+ reflectAction(type, field.Name, field.GetValue(this));
+ }
+ }
+
+
+
+ /// <summary>
+ /// Creates a clone of the object, generally shallow.
+ /// </summary>
+ /// <returns>an the clone of the current instance.</returns>
+ public virtual object Clone()
+ {
+ var obj = this.MemberwiseClone();
+ return obj;
+ }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSource.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSource.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSource.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSource.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,113 @@
+// -----------------------------------------------------------------------
+// <copyright file="AttributeSource.cs" company="Apache">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Util
+{
+ using System;
+ using System.Collections.Generic;
+ using Support;
+
+
+ /// <summary>
+ /// An <c>AttributeSource</c> contains a list of different <see cref="AttributeBase"/>s,
+ /// and methods to add and get them. There can only be a single instance
+ /// of an attribute in the same AttributeSource instance. This is ensured
+ /// by passing in the actual type of the Attribute to
+ /// the <see cref="AddAttribute(Type)" />, which then checks if an instance of
+ /// that type is already present. If yes, it returns the instance, otherwise
+ /// it creates a new instance and returns it.
+ /// </summary>
+ /// <remarks>
+ /// <note>
+ /// <para>
+ /// <b>Java File: </b> <a href="https://github.com/apache/lucene-solr/blob/trunk/lucene/src/java/org/apache/lucene/util/AttributeSource.java">
+ /// lucene/src/java/org/apache/lucene/util/AttributeSource.java
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# File: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/src/Lucene.Net/Util/AttributeSource.cs">
+ /// src/Lucene.Net/Util/AttributeSource.cs
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# Tests: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/test/Lucene.Net.Test/Util/AttributeSourceTest.cs">
+ /// test/Lucene.Net.Test/Util/AttributeSourceTest.cs
+ /// </a>
+ /// </para>
+ /// </note>
+ /// </remarks>
+ public class AttributeSource
+ {
+ private static readonly object instanceLock = new object();
+
+ private static readonly WeakDictionary<Type, LinkedList<WeakReference<Type>>> knownAttributeClasses =
+ new WeakDictionary<Type, LinkedList<WeakReference<Type>>>();
+
+ /// <summary>
+ /// Gets the attribute interfaces.
+ /// </summary>
+ /// <param name="type">The type.</param>
+ /// <returns>
+ /// an instance of <see cref="LinkedList{T}"/> of <see cref="WeakReference{T}"/> of <see cref="Type"/>
+ /// that hold the known interfaces that inherit from <see cref="IAttribute"/>.
+ /// </returns>
+ public static LinkedList<WeakReference<Type>> GetAttributeInterfaces(Type type)
+ {
+ lock (instanceLock)
+ {
+ LinkedList<WeakReference<Type>> foundInterfaces = knownAttributeClasses.GetDefaultedValue(type);
+
+ if (foundInterfaces == null)
+ {
+ knownAttributeClasses[type] = foundInterfaces = new LinkedList<WeakReference<Type>>();
+
+ Type attributeInterface = typeof(IAttribute);
+ Type activeType = type;
+
+ do
+ {
+ foreach (Type currentInterface in activeType.GetInterfaces())
+ {
+ if (currentInterface != attributeInterface &&
+ attributeInterface.IsAssignableFrom(currentInterface))
+ {
+ foundInterfaces.AddLast(new WeakReference<Type>(currentInterface));
+ }
+ }
+
+ activeType = activeType.BaseType;
+ } while (activeType != null);
+ }
+
+ return foundInterfaces;
+ }
+ }
+
+ /// <summary>
+ /// Adds an attribute.
+ /// </summary>
+ /// <param name="attributeType">The type of attribute that is to be added.</param>
+ public void AddAttribute(Type attributeType)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/IAttribute.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/IAttribute.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/IAttribute.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/IAttribute.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,51 @@
+// -----------------------------------------------------------------------
+// <copyright file="IAttribute.cs" company="Apache">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Util
+{
+ /// <summary>
+ /// The contract interface for attributes. This interface is used as
+ /// a way to query types that extend or implement an interface that
+ /// extends this interface and create references to those types that do.
+ /// </summary>
+ /// <remarks>
+ /// <note>
+ /// <para>
+ /// <b>Java File: </b> <a href="https://github.com/apache/lucene-solr/blob/trunk/lucene/src/java/org/apache/lucene/util/Attribute.java">
+ /// lucene/src/java/org/apache/lucene/util/Attribute.java
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# File: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/src/Lucene.Net/Util/IAttribute.cs">
+ /// src/Lucene.Net/Util/IAttribute.cs
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# Tests: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/test/Lucene.Net.Test/Util/IAttributeTest.cs">
+ /// test/Lucene.Net.Test/Util/IAttributeTest.cs
+ /// </a>
+ /// </para>
+ /// </note>
+ /// </remarks>
+ public interface IAttribute
+ {
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/RamUsageEstimator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/RamUsageEstimator.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/RamUsageEstimator.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/RamUsageEstimator.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,70 @@
+// -----------------------------------------------------------------------
+// <copyright company="Apache" file="RamUsageEstimator.cs">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Util
+{
+ using System;
+
+ /// <summary>
+ /// Estimates the size of a given object using a given <c>MemoryModel</c>
+ /// for primitive size information.
+ /// </summary>
+ /// <remarks>
+ /// <note>
+ /// <para>
+ /// <b>Java File: </b> <a href="https://github.com/apache/lucene-solr/blob/trunk/lucene/src/java/org/apache/lucene/util/RamUsageEstimator.java">
+ /// lucene/src/java/org/apache/lucene/util/RamUseageEstimator.java
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# File: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/src/Lucene.Net/Util/RamUsageEstimator.cs">
+ /// src/Lucene.Net/Util/RamUsageEstimator.cs
+ /// </a>
+ /// </para>
+ /// <para>
+ /// <b>C# Tests: </b> <a href="https://github.com/wickedsoftware/lucene.net/tree/lucene-net-4/test/Lucene.Net.Test/Util/RamUsageEstimatorTest.cs">
+ /// test/Lucene.Net.Test/Util/RamUsageEstimatorTest.cs
+ /// </a>
+ /// </para>
+ /// </note>
+ /// <para>
+ /// Internally uses a Map to temporally hold a reference to every object seen.
+ /// </para>
+ /// <para>
+ /// If checkInterned all strings checked will be interned, but those
+ /// that were not already interned will be released for GC when the
+ /// estimate is complete.
+ /// </para>
+ /// </remarks>
+ public class RamUsageEstimator
+ {
+ /// <summary>
+ /// The number of bytes for an object reference. This will either
+ /// be 8 (64 bit) or 4 (32 bit).
+ /// </summary>
+ public static readonly int NumBytesObjectRef = IntPtr.Size;
+
+ /// <summary>
+ /// The number of bytes for a char.
+ /// </summary>
+ public const int NumBytesChar = 2;
+ }
+}
\ No newline at end of file
Added: incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Analysis/TokenAttributes/CharTermAttributeTest.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Analysis/TokenAttributes/CharTermAttributeTest.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Analysis/TokenAttributes/CharTermAttributeTest.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Analysis/TokenAttributes/CharTermAttributeTest.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,224 @@
+// -----------------------------------------------------------------------
+// <copyright company="Apache" file="CharTermAttributeTest.cs" >
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+
+
+namespace Lucene.Net.Analysis.TokenAttributes
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using System.Text.RegularExpressions;
+ using Categories = Lucene.Net.TestCategories;
+ using Internal;
+
+#if NUNIT
+ using NUnit.Framework;
+ using Extensions.NUnit;
+#else
+ using Gallio.Framework;
+ using MbUnit.Framework;
+#endif
+
+
+ [TestFixture]
+ [Category(Categories.Unit)]
+ [Parallelizable]
+ public class CharTermAttributeTest
+ {
+ /*
+ [Test]
+ public void Append()
+ {
+ var attribute = new CharTermAttribute();
+
+
+ }*/
+
+
+ [Test]
+ public void Grow()
+ {
+ var attribute = new CharTermAttribute();
+ var buffer = new StringBuilder("ab");
+
+ Console.WriteLine(IntPtr.Size == 4 ? "x86" : "64bit ");
+
+ // this currently fails running in 64 bit mode in Gallio
+ // TODO: figure out the issue with running this attribute in 64bit. possibly the bit length.
+ if (IntPtr.Size == 8)
+ return;
+
+
+ for (int i = 0; i < 20; i++)
+ {
+ var content = buffer.ToString().ToCharArray();
+ attribute.CopyBuffer(content);
+ Assert.AreEqual(buffer.Length, attribute.Length);
+ Assert.AreEqual(buffer.ToString(), attribute.ToString());
+ buffer.Append(buffer.ToString());
+ }
+
+ Assert.AreEqual(1048576, attribute.Length);
+
+
+
+ attribute = new CharTermAttribute();
+ buffer = new StringBuilder("ab");
+
+ for (int i = 0; i < 20; i++)
+ {
+ attribute.Empty().Append(buffer);
+ Assert.AreEqual(buffer.Length, attribute.Length);
+ Assert.AreEqual(buffer.ToString(), attribute.ToString());
+ buffer.Append(attribute);
+ }
+
+ Assert.AreEqual(1048576, attribute.Length);
+
+
+
+ attribute = new CharTermAttribute();
+ buffer = new StringBuilder("a");
+
+ for (int i = 0; i < 20000; i++)
+ {
+ attribute.Empty().Append(buffer);
+ Assert.AreEqual(buffer.Length, attribute.Length);
+ Assert.AreEqual(buffer.ToString(), attribute.ToString());
+ buffer.Append("a");
+ }
+ Assert.AreEqual(20000, attribute.Length);
+ }
+
+
+ [Test]
+ public void CharSequence()
+ {
+ // Note that c# does not support the CharSquence interface, but
+ // its possible to still test the api to some degree.
+
+ string value = "0123456789";
+ var attribute = new CharTermAttribute();
+ attribute.Append(value);
+
+ Assert.AreEqual(value.Length, attribute.Length);
+ Assert.AreEqual("12", attribute.ToString().Substring(1, 2));
+ Assert.AreEqual(value, attribute.ToString().Substring(0, value.Length));
+
+ Assert.IsTrue(Regex.IsMatch(attribute.ToString(), @"01\d+"));
+ Assert.IsTrue(Regex.IsMatch(attribute.ToString().Substring(3,5), "34"));
+
+ Assert.AreEqual(value.Substring(3,7), attribute.ToString().Substring(3,7));
+
+ for (int i = 0; i < value.Length; i++)
+ {
+ Assert.AreEqual(value[i], attribute.CharAt(i));
+ }
+ }
+
+ [Test]
+ public void Clone()
+ {
+ var attribute = new CharTermAttribute();
+ var content = "hello".ToCharArray();
+
+ attribute.CopyBuffer(content,0, 5);
+ var copy = attribute.CreateCloneAndAssertEqual();
+
+ Assert.AreEqual(attribute.ToString(), copy.ToString());
+ Assert.AreNotSame(attribute.Buffer, copy.Buffer);
+ }
+
+ [Test]
+ public void Copy()
+ {
+ var attribute = new CharTermAttribute();
+ var copy = attribute.CreateCopyAndAssertEqual();
+
+ Assert.AreEqual(string.Empty, attribute.ToString());
+ Assert.AreEqual(string.Empty, copy.ToString());
+
+ attribute = new CharTermAttribute();
+ attribute.CopyBuffer("hello".ToCharArray());
+
+ var buffer = attribute.Buffer;
+ copy = attribute.CreateCopyAndAssertEqual();
+
+ Assert.AreEqual(attribute.ToString(), copy.ToString());
+ Assert.AreNotSame(buffer, copy.Buffer);
+ }
+
+ [Test]
+ public void EqualsOverride()
+ {
+ var attribute = new CharTermAttribute();
+ var content = "hello".ToCharArray();
+
+ attribute.CopyBuffer(content);
+
+ var attributeMirror = new CharTermAttribute();
+ var contentMirror = "hello".ToCharArray();
+
+ attributeMirror.CopyBuffer(contentMirror);
+
+ var attributeOutcast = new CharTermAttribute();
+ var contentOutcast = "hello2".ToCharArray();
+ attributeOutcast.CopyBuffer(contentOutcast);
+
+ Assert.IsTrue(attribute.Equals(attributeMirror));
+ Assert.IsFalse(attribute.Equals(attributeOutcast));
+ Assert.IsFalse(attributeOutcast.Equals(attributeMirror));
+
+ }
+
+ [Test]
+ public void Resize()
+ {
+ var attribute = new CharTermAttribute();
+ var content = "hello".ToCharArray();
+ attribute.CopyBuffer(content, 0, content.Length);
+
+ for (int i = 0; i < 2000; i++)
+ {
+ attribute.ResizeBuffer(i);
+ Assert.IsTrue(i <= attribute.Buffer.Length, "i is {0} and buffer length is {1}", i, attribute.Buffer.Length);
+ Assert.AreEqual("hello", attribute.ToString());
+ }
+ }
+
+ [Test]
+ public void ToStringOverride()
+ {
+ var sequence = new[] { 'a', 'l', 'o', 'h', 'a' };
+ var attribute = new CharTermAttribute();
+
+ attribute.CopyBuffer(sequence, 0, sequence.Length);
+
+ Assert.AreEqual("aloha", attribute.ToString());
+
+ attribute.Empty().Append("hi there");
+
+ Assert.AreEqual("hi there", attribute.ToString());
+ }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Analysis/TokenAttributes/FlagsAttributeTest.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Analysis/TokenAttributes/FlagsAttributeTest.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Analysis/TokenAttributes/FlagsAttributeTest.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Analysis/TokenAttributes/FlagsAttributeTest.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,132 @@
+// -----------------------------------------------------------------------
+// <copyright file="FlagsAttributeTest.cs" company="Apache">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Analysis.TokenAttributes
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+ using Lucene.Net.Util;
+
+#if NUNIT
+ using NUnit.Framework;
+ using Extensions.NUnit;
+#else
+ using Gallio.Framework;
+ using MbUnit.Framework;
+#endif
+
+
+ [TestFixture]
+ [Category(TestCategories.Unit)]
+ [Parallelizable]
+ public class FlagsAttributeTest
+ {
+ [Test]
+ public void Flags()
+ {
+ var attribute = new FlagsAttribute { Flags = 5 };
+ Assert.AreEqual(5, attribute.Flags);
+ }
+
+ [Test]
+ public void Clear()
+ {
+ var attribute = new FlagsAttribute { Flags = 5 };
+ Assert.AreEqual(5, attribute.Flags);
+
+ attribute.Clear();
+ Assert.AreEqual(0, attribute.Flags);
+ }
+
+ [Test]
+ public void Clone()
+ {
+ var attribute = new FlagsAttribute { Flags = 5 };
+ Assert.AreEqual(5, attribute.Flags);
+
+ var clone = attribute.Clone() as FlagsAttribute;
+ Assert.IsNotNull(clone);
+ Assert.AreEqual(5, clone.Flags);
+ }
+
+ [Test]
+ public void CopyTo()
+ {
+ var attribute = new FlagsAttribute { Flags = 5 };
+ Assert.AreEqual(5, attribute.Flags);
+
+ var copy = new FlagsAttribute();
+ attribute.CopyTo(copy);
+
+ Assert.AreEqual(5, copy.Flags);
+ }
+
+ [Test]
+ public void CopyTo_WithArgumentException()
+ {
+ var attribute = new FlagsAttribute { Flags = 5 };
+ Assert.AreEqual(5, attribute.Flags);
+
+ Assert.Throws<ArgumentException>(() => attribute.CopyTo(new NonFlagAttribute()));
+ }
+
+ [Test]
+ public void EqualsOverride()
+ {
+ var attribute = new FlagsAttribute { Flags = 25 };
+ Assert.AreEqual(25, attribute.Flags);
+
+ var y = new FlagsAttribute { Flags = 25 };
+
+ Assert.IsTrue(attribute.Equals(y));
+ }
+
+ [Test]
+ public void GetHashCodeOverride()
+ {
+ var attribute = new FlagsAttribute { Flags = 25 };
+ Assert.AreEqual(25, attribute.Flags);
+
+ Assert.AreEqual(25, attribute.GetHashCode());
+ }
+
+ #region helpers
+
+ private class NonFlagAttribute : AttributeBase
+ {
+
+ public override void Clear()
+ {
+ throw new NotImplementedException();
+ }
+
+ public override void CopyTo(AttributeBase attributeBase)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ #endregion
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Internal/AttributeExtensions.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Internal/AttributeExtensions.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Internal/AttributeExtensions.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Internal/AttributeExtensions.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,60 @@
+// -----------------------------------------------------------------------
+// <copyright company="Apache" file="AttributeExtensions.cs">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+
+
+namespace Lucene.Net.Internal
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using Util;
+ using NUnit.Framework;
+
+ /// <summary>
+ ///
+ /// </summary>
+ public static class AttributeExtensions
+ {
+
+ public static T CreateCloneAndAssertEqual<T>(this T attribute) where T : AttributeBase
+ {
+ T clone = (T) attribute.Clone();
+
+ Assert.AreEqual(attribute, clone, "The clone must be equal");
+ Assert.AreEqual(attribute.GetHashCode(), clone.GetHashCode());
+
+ return clone;
+ }
+
+ public static T CreateCopyAndAssertEqual<T>(this T attribute) where T : AttributeBase
+ {
+ T copy = Activator.CreateInstance<T>();
+ attribute.CopyTo(copy);
+
+ Assert.AreEqual(attribute, copy, "The clone must be equal");
+ Assert.AreEqual(attribute.GetHashCode(), copy.GetHashCode());
+
+ return copy;
+ }
+ }
+}
\ No newline at end of file
Added: incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Internal/ReferenceType.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Internal/ReferenceType.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Internal/ReferenceType.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Internal/ReferenceType.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,19 @@
+// -----------------------------------------------------------------------
+// <copyright file="ReferenceType.cs" company="Microsoft">
+// TODO: Update copyright text.
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Internal
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+
+ internal class ReferenceType
+ {
+ public string Name { get; set; }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Lucene.Net.Test.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Lucene.Net.Test.csproj?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Lucene.Net.Test.csproj (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Lucene.Net.Test.csproj Fri Aug 5 19:21:18 2011
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1152BC40-6656-42C6-9FA2-4CA7E124CB87}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Lucene.Net</RootNamespace>
+ <AssemblyName>Lucene.Net.Test</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\build\bin\core\Debug\</OutputPath>
+ <DefineConstants>TRACE;DEBUG;NUNIT</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Gallio, Version=3.2.0.0, Culture=neutral, PublicKeyToken=eb9cfa67ee6ab36e, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\packages\Gallio.3.2.750\tools\Gallio.dll</HintPath>
+ </Reference>
+ <Reference Include="Gallio40">
+ <HintPath>..\..\packages\Gallio.3.2.750\tools\Gallio40.dll</HintPath>
+ </Reference>
+ <Reference Include="MbUnit">
+ <HintPath>..\..\packages\Gallio.3.2.750\tools\MbUnit.dll</HintPath>
+ </Reference>
+ <Reference Include="MbUnit40">
+ <HintPath>..\..\packages\Gallio.3.2.750\tools\MbUnit40.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework">
+ <HintPath>..\..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Analysis\TokenAttributes\CharTermAttributeTest.cs" />
+ <Compile Include="Analysis\TokenAttributes\FlagsAttributeTest.cs" />
+ <Compile Include="Internal\AttributeExtensions.cs" />
+ <Compile Include="Internal\ReferenceType.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Support\DictionaryExtensionsTest.cs" />
+ <Compile Include="Support\WeakDictionaryOfTKeyTValueTest.cs" />
+ <Compile Include="Support\WeakReferenceOfTTest.cs" />
+ <Compile Include="Util\ArrayUtilTest.cs" />
+ <Compile Include="Util\AttributeSourceTest.cs" />
+ <Compile Include="Util\AttributeBaseTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\src\Lucene.Net.TestFramework\Lucene.Net.TestFramework.csproj">
+ <Project>{756B5043-39EC-4C04-AC1F-AA959267DDC1}</Project>
+ <Name>Lucene.Net.TestFramework</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\src\Lucene.Net\Lucene.Net.csproj">
+ <Project>{07A5FF70-1EFE-4B0B-B338-5CA56C3A2826}</Project>
+ <Name>Lucene.Net</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Condition="Exists('..\..\packages\StyleCop.4.5\StyleCop.targets')" Project="..\..\packages\StyleCop.4.5\StyleCop.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Properties/AssemblyInfo.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Properties/AssemblyInfo.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Properties/AssemblyInfo.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,57 @@
+// -----------------------------------------------------------------------
+// <copyright company="Apache" file="AssemblyInfo.cs">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Lucene.Net.Tests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("Lucene.Net.Tests")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("ba913a87-9532-44ad-9a8b-fff75c1faca1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Settings.StyleCop
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Settings.StyleCop?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Settings.StyleCop (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Settings.StyleCop Fri Aug 5 19:21:18 2011
@@ -0,0 +1,564 @@
+<StyleCopSettings Version="105">
+ <Analyzers>
+ <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
+ <Rules>
+ <Rule Name="ElementsMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PartialElementsMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="EnumerationItemsMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationMustContainValidXml">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationMustHaveSummary">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PartialElementDocumentationMustHaveSummary">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationMustHaveSummaryText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PartialElementDocumentationMustHaveSummaryText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementParametersMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementParameterDocumentationMustMatchElementParameters">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementParameterDocumentationMustDeclareParameterName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementParameterDocumentationMustHaveText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementReturnValueMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementReturnValueDocumentationMustHaveText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="VoidReturnValueMustNotBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParametersMustBeDocumented">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="GenericTypeParameterDocumentationMustHaveText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PropertySummaryDocumentationMustMatchAccessors">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationTextMustNotBeEmpty">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationTextMustContainWhitespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationMustMeetCharacterPercentage">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationHeadersMustNotContainBlankLines">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="IncludedDocumentationXPathDoesNotExist">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="InheritDocMustBeUsedWithInheritingClass">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
+ <Rules>
+ <Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="StatementMustNotBeOnSingleLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementMustNotBeOnSingleLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CurlyBracketsMustNotBeOmitted">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="AllAccessorsMustBeMultiLineOrSingleLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningCurlyBracketsMustNotBeFollowedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationHeadersMustNotBeFollowedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainMultipleBlankLinesInARow">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingCurlyBracketsMustNotBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningCurlyBracketsMustNotBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ChainedStatementBlocksMustNotBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="WhileDoFooterMustNotBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingCurlyBracketMustBeFollowedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementDocumentationHeaderMustBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentMustBePrecededByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementsMustBeSeparatedByBlankLine">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainBlankLinesAtStartOfFile">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainBlankLinesAtEndOfFile">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
+ <Rules>
+ <Rule Name="AccessModifierMustBeDeclared">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FieldsMustBePrivate">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeAnalysisSuppressionMustHaveJustification">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DebugAssertMustProvideMessageText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DebugFailMustProvideMessageText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileMayOnlyContainASingleClass">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileMayOnlyContainASingleNamespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="StatementMustNotUseUnnecessaryParenthesis">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ArithmeticExpressionsMustDeclarePrecedence">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ConditionalExpressionsMustDeclarePrecedence">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="RemoveDelegateParenthesisWhenPossible">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="AttributeConstructorMustNotUseUnnecessaryParenthesis">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="RemoveUnnecessaryCode">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
+ <Rules>
+ <Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementsMustAppearInTheCorrectOrder">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ElementsMustBeOrderedByAccess">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ConstantsMustAppearBeforeFields">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="StaticElementsMustAppearBeforeInstanceElements">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DeclarationKeywordsMustFollowOrder">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ProtectedMustComeBeforeInternal">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PropertyAccessorsMustFollowOrder">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="EventAccessorsMustFollowOrder">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UsingAliasDirectivesMustBePlacedAfterOtherUsingDirectives">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UsingDirectivesMustBeOrderedAlphabeticallyByNamespace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="UsingAliasDirectivesMustBeOrderedAlphabeticallyByAliasName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
+ <Rules>
+ <Rule Name="KeywordsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CommasMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SemicolonsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DocumentationLinesMustBeginWithSingleSpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="SingleLineCommentsMustBeginWithSingleSpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PreprocessorKeywordsMustNotBePrecededBySpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OperatorKeywordMustBeFollowedBySpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningParenthesisMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingParenthesisMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningSquareBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingSquareBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningCurlyBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingCurlyBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningGenericBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingGenericBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="OpeningAttributeBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ClosingAttributeBracketsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="NullableTypeSymbolsMustNotBePrecededBySpace">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="MemberAccessSymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="IncrementDecrementSymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="NegativeSignsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="PositiveSignsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="DereferenceAndAccessOfSymbolsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="ColonsMustBeSpacedCorrectly">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainMultipleWhitespaceInARow">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="TabsMustNotBeUsed">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ </Analyzers>
+</StyleCopSettings>
\ No newline at end of file
Added: incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Support/DictionaryExtensionsTest.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Support/DictionaryExtensionsTest.cs?rev=1154359&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Support/DictionaryExtensionsTest.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/test/Lucene.Net.Test/Support/DictionaryExtensionsTest.cs Fri Aug 5 19:21:18 2011
@@ -0,0 +1,65 @@
+// -----------------------------------------------------------------------
+// <copyright file="DictionaryExtensionsTest.cs" company="Apache">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Support
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+
+#if NUNIT
+ using NUnit.Framework;
+ using Extensions.NUnit;
+#else
+ using Gallio.Framework;
+ using MbUnit.Framework;
+#endif
+
+ using Categories = Lucene.Net.TestCategories;
+
+ [TestFixture]
+ [Category(Categories.Unit)]
+ [Parallelizable]
+ public class DictionaryExtensionsTest
+ {
+
+ [Test]
+ public void GetDefaultValue()
+ {
+ var dictionary = new Dictionary<string, string>();
+ var dictionaryWithInt = new Dictionary<string, int>();
+
+ var defaultedValue1 = dictionary.GetDefaultedValue("key does not exist");
+
+ Assert.IsFalse(dictionary.ContainsKey("key does not exist"));
+ Assert.IsNull(defaultedValue1, "The value should return null when the key does not exist");
+
+ dictionary["key"] = "value";
+
+ Assert.IsNotNull(dictionary["key"]);
+ Assert.AreEqual("value", dictionary["key"]);
+
+ Assert.IsNotNull(dictionaryWithInt.GetDefaultedValue("key does not exist"));
+ Assert.AreEqual(0, dictionaryWithInt.GetDefaultedValue("key does not exist"));
+ }
+ }
+}