Skip to content

Commit

Permalink
First round of removing use of persistent non-generic collections fro…
Browse files Browse the repository at this point in the history
…m the test suite.
  • Loading branch information
oskarb committed Mar 8, 2013
1 parent 38164e7 commit 777ca5b
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 118 deletions.
88 changes: 44 additions & 44 deletions src/NHibernate.DomainModel/Baz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ public class Baz : INamed, IComparable
private Int32 _count;
private String _name;
private Foo _foo;
private IList _stringList;
private IList _fees;
private IList _customs;
private IList _topComponents;
private IDictionary _fooToGlarch;
private IDictionary _fooComponentToFoo;
private IDictionary _glarchToFoo;
private IDictionary _stringDateMap;
private IDictionary _topGlarchez;
private IDictionary _cachedMap;
private IDictionary _stringGlarchMap;
private IDictionary _anyToAny;
private IList _manyToAny;
private IList<string> _stringList;
private IList<Fee> _fees;
private IList<string[]> _customs;
private IList<FooComponent> _topComponents;
private IDictionary<Foo, GlarchProxy> _fooToGlarch;
private IDictionary<FooComponent, Foo> _fooComponentToFoo;
private IDictionary<Foo, GlarchProxy> _glarchToFoo;
private IDictionary<string, DateTime?> _stringDateMap;
private IDictionary<char, GlarchProxy> _topGlarchez;
private IDictionary<Baz, CompositeElement> _cachedMap;
private IDictionary<string, Glarch> _stringGlarchMap;
private IDictionary<object, object> _anyToAny;
private IList<object> _manyToAny;
private ISet<FooProxy> _fooSet;
private ISet<string> _stringSet;
private ISet<Bar> _topFoos;
private ISet<BarProxy> _cascadingBars;
private ISet<CompositeElement> _cached;
private ISet<Sortable> _sortablez;
private IList _bag;
private IList _fooBag;
private IList _idFooBag;
private IList _byteBag;
private IList _bazez;
private IList _parts;
private IList<string> _bag;
private IList<Foo> _fooBag;
private IList<Foo> _idFooBag;
private IList<byte[]> _byteBag;
private IList<Baz> _bazez;
private IList<Part> _parts;

#endregion

Expand Down Expand Up @@ -110,7 +110,7 @@ public Foo Foo
/// <summary>
/// Get/set for stringList
/// </summary>
public IList StringList
public IList<string> StringList
{
get { return this._stringList; }
set { this._stringList = value; }
Expand All @@ -119,7 +119,7 @@ public IList StringList
/// <summary>
/// Get/set for fees
/// </summary>
public IList Fees
public IList<Fee> Fees
{
get { return _fees; }
set { _fees = value; }
Expand All @@ -128,7 +128,7 @@ public IList Fees
/// <summary>
/// Get/set for customs
/// </summary>
public IList Customs
public IList<string[]> Customs
{
get { return this._customs; }
set { this._customs = value; }
Expand All @@ -137,7 +137,7 @@ public IList Customs
/// <summary>
/// Get/set for topComponents
/// </summary>
public IList TopComponents
public IList<FooComponent> TopComponents
{
get { return this._topComponents; }
set { this._topComponents = value; }
Expand All @@ -146,7 +146,7 @@ public IList TopComponents
/// <summary>
/// Get/set for fooToGlarch
/// </summary>
public IDictionary FooToGlarch
public IDictionary<Foo, GlarchProxy> FooToGlarch
{
get { return this._fooToGlarch; }
set { this._fooToGlarch = value; }
Expand All @@ -155,7 +155,7 @@ public IDictionary FooToGlarch
/// <summary>
/// Get/set for fooComponentToFoo
/// </summary>
public IDictionary FooComponentToFoo
public IDictionary<FooComponent, Foo> FooComponentToFoo
{
get { return this._fooComponentToFoo; }
set { this._fooComponentToFoo = value; }
Expand All @@ -164,7 +164,7 @@ public IDictionary FooComponentToFoo
/// <summary>
/// Get/set for glarchToFoo
/// </summary>
public IDictionary GlarchToFoo
public IDictionary<Foo, GlarchProxy> GlarchToFoo
{
get { return this._glarchToFoo; }
set { this._glarchToFoo = value; }
Expand All @@ -173,7 +173,7 @@ public IDictionary GlarchToFoo
/// <summary>
/// Get/set for stringDateMap
/// </summary>
public IDictionary StringDateMap
public IDictionary<string, DateTime?> StringDateMap
{
get { return this._stringDateMap; }
set { this._stringDateMap = value; }
Expand All @@ -182,7 +182,7 @@ public IDictionary StringDateMap
/// <summary>
/// Get/set for topGlarchez
/// </summary>
public IDictionary TopGlarchez
public IDictionary<char, GlarchProxy> TopGlarchez
{
get { return this._topGlarchez; }
set { this._topGlarchez = value; }
Expand All @@ -191,7 +191,7 @@ public IDictionary TopGlarchez
/// <summary>
/// Get/set for cachedMap
/// </summary>
public IDictionary CachedMap
public IDictionary<Baz,CompositeElement> CachedMap
{
get { return this._cachedMap; }
set { this._cachedMap = value; }
Expand All @@ -200,7 +200,7 @@ public IDictionary CachedMap
/// <summary>
/// Get/set for stringGlarchMap
/// </summary>
public IDictionary StringGlarchMap
public IDictionary<string, Glarch> StringGlarchMap
{
get { return this._stringGlarchMap; }
set { this._stringGlarchMap = value; }
Expand All @@ -209,7 +209,7 @@ public IDictionary StringGlarchMap
/// <summary>
/// Get/set for anyToAny
/// </summary>
public IDictionary AnyToAny
public IDictionary<object, object> AnyToAny
{
get { return this._anyToAny; }
set { this._anyToAny = value; }
Expand All @@ -218,7 +218,7 @@ public IDictionary AnyToAny
/// <summary>
/// Get/set for manyToAny
/// </summary>
public IList ManyToAny
public IList<object> ManyToAny
{
get { return this._manyToAny; }
set { this._manyToAny = value; }
Expand Down Expand Up @@ -328,7 +328,7 @@ public ISet<Sortable> Sortablez
/// <summary>
/// Get/set for bag
/// </summary>
public IList Bag
public IList<string> Bag
{
get { return this._bag; }
set { this._bag = value; }
Expand All @@ -337,7 +337,7 @@ public IList Bag
/// <summary>
/// Get/set for fooBag
/// </summary>
public IList FooBag
public IList<Foo> FooBag
{
get { return this._fooBag; }
set { this._fooBag = value; }
Expand All @@ -346,7 +346,7 @@ public IList FooBag
/// <summary>
/// Get/set for bazez
/// </summary>
public IList Bazez
public IList<Baz> Bazez
{
get { return this._bazez; }
set { this._bazez = value; }
Expand All @@ -355,7 +355,7 @@ public IList Bazez
/// <summary>
/// Get/set for idFooBag
/// </summary>
public IList IdFooBag
public IList<Foo> IdFooBag
{
get { return this._idFooBag; }
set { this._idFooBag = value; }
Expand All @@ -364,7 +364,7 @@ public IList IdFooBag
/// <summary>
/// Get/set for byteBag
/// </summary>
public IList ByteBag
public IList<byte[]> ByteBag
{
get { return this._byteBag; }
set { this._byteBag = value; }
Expand All @@ -373,7 +373,7 @@ public IList ByteBag
/// <summary>
/// Get/set for parts
/// </summary>
public IList Parts
public IList<Part> Parts
{
get { return this._parts; }
set { this._parts = value; }
Expand All @@ -387,18 +387,18 @@ public void SetDefaults()

StringSet = new HashSet<string> {"foo", "bar", "baz"};

StringDateMap = new SortedList();
StringDateMap = new SortedList<string, DateTime?>();
StringDateMap.Add("now", DateTime.Now);
StringDateMap.Add("never", null); // value is persisted since NH-2199
// according to SQL Server the big bag happened in 1753 ;)
StringDateMap.Add("big bang", new DateTime(1753, 01, 01));
//StringDateMap.Add( "millenium", new DateTime( 2000, 01, 01 ) );
StringArray = StringSet.ToArray();
StringList = new ArrayList(StringArray);
StringList = new List<string>(StringArray);
IntArray = new int[] {1, 3, 3, 7};
FooArray = new Foo[0];

Customs = new ArrayList();
Customs = new List<string[]>();
Customs.Add(new String[] {"foo", "bar"});
Customs.Add(new String[] {"A", "B"});
Customs.Add(new String[] {"1", "2"});
Expand All @@ -419,12 +419,12 @@ public void SetDefaults()

Count = 667;
Name = "Bazza";
TopComponents = new ArrayList();
TopComponents = new List<FooComponent>();
TopComponents.Add(new FooComponent("foo", 11, new DateTime[] {today, new DateTime(2123, 1, 1)}, null));
TopComponents.Add(
new FooComponent("bar", 22, new DateTime[] {new DateTime(2007, 2, 3), new DateTime(1945, 6, 1)}, null));
TopComponents.Add(null);
Bag = new ArrayList();
Bag = new List<string>();
Bag.Add("duplicate");
Bag.Add("duplicate");
Bag.Add("duplicate");
Expand All @@ -440,7 +440,7 @@ public void SetDefaults()
ce2.Bar = "barxxx";
Cached.Add(ce);
Cached.Add(ce2);
CachedMap = new SortedList();
CachedMap = new SortedList<Baz, CompositeElement>();
CachedMap.Add(this, ce);
}

Expand Down
6 changes: 3 additions & 3 deletions src/NHibernate.DomainModel/Baz.hbm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@
<element column="element" type="String" not-null="true" length="32"/>
</set>

<map name="StringDateMap" lazy="true" sort="ReverseComparator">
<map name="StringDateMap" lazy="true" sort="ReverseComparator" collection-type="sorted-list">
<key column="id_"/>
<index column="map_key" type="String" length="32"/>
<element column="map_value" type="DateTime"/>
<element column="map_value" type="DateTime" />
</map>

<array name="FooArray" element-class="FooProxy" where="i&lt;8">
Expand Down Expand Up @@ -295,7 +295,7 @@
</composite-element>
</set>

<map name="CachedMap" sort="natural" table="cached_map">
<map name="CachedMap" sort="natural" table="cached_map" collection-type="sorted-list">
<!--<cache usage="read-write"/>-->
<key column="baz"/>
<index-many-to-many column="another_baz" class="Baz"/>
Expand Down
5 changes: 3 additions & 2 deletions src/NHibernate.DomainModel/C2.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;

namespace NHibernate.DomainModel
{
Expand Down Expand Up @@ -27,7 +28,7 @@ public class C2 : B
/// <summary>
/// Holder for c1s
/// </summary>
private IList _c1s = new ArrayList();
private IList<C1> _c1s = new List<C1>();

#endregion

Expand Down Expand Up @@ -81,7 +82,7 @@ public virtual C1 C1
set { _c1 = value; }
}

public virtual IList C1s
public virtual IList<C1> C1s
{
get { return _c1s; }
set { _c1s = value; }
Expand Down
12 changes: 6 additions & 6 deletions src/NHibernate.DomainModel/NHSpecific/BasicClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public class BasicClass

private string[] _stringArray;
private int[] _int32Array;
private IList _stringBag;
private IList _stringList;
private IDictionary _stringMap;
private IList<string> _stringBag;
private IList<string> _stringList;
private IDictionary<string, string> _stringMap;
private IDictionary<string, string> _stringMapGeneric;
private ISet<string> _stringSet;

Expand Down Expand Up @@ -150,19 +150,19 @@ public int[] Int32Array
set { _int32Array = value; }
}

public IList StringBag
public IList<string> StringBag
{
get { return _stringBag; }
set { _stringBag = value; }
}

public IList StringList
public IList<string> StringList
{
get { return _stringList; }
set { _stringList = value; }
}

public IDictionary StringMap
public IDictionary<string, string> StringMap
{
get { return _stringMap; }
set { _stringMap = value; }
Expand Down
8 changes: 4 additions & 4 deletions src/NHibernate.DomainModel/ReverseComparator.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using System;
using System.Collections;
using System.Collections.Generic;

namespace NHibernate.DomainModel
{
[Serializable]
public class ReverseComparator : IComparer
public class ReverseComparator : IComparer<string>
{
#region IComparer Members

public int Compare(object x, object y)
public int Compare(string x, string y)
{
return - ((IComparable) x).CompareTo(y);
return - (x).CompareTo(y);
}

#endregion
Expand Down
3 changes: 2 additions & 1 deletion src/NHibernate.Test/ConnectionTest/AggressiveReleaseTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using NHibernate.Cfg;
using NHibernate.Util;
Expand Down Expand Up @@ -218,7 +219,7 @@ public void ConnectionMaintanenceDuringFlush()
ISession s = GetSessionUnderTest();
s.BeginTransaction();

IList entities = new ArrayList();
IList<Silly> entities = new List<Silly>();
for (int i = 0; i < 10; i++)
{
Other other = new Other("other-" + i);
Expand Down
Loading

0 comments on commit 777ca5b

Please sign in to comment.