|
From: <fab...@us...> - 2008-07-23 19:01:02
|
Revision: 3657
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=3657&view=rev
Author: fabiomaulo
Date: 2008-07-23 19:01:10 +0000 (Wed, 23 Jul 2008)
Log Message:
-----------
Port tests from H3.2 (check same behavior)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/Any/
trunk/nhibernate/src/NHibernate.Test/Any/Address.cs
trunk/nhibernate/src/NHibernate.Test/Any/AnyTypeTest.cs
trunk/nhibernate/src/NHibernate.Test/Any/ComplexPropertyValue.cs
trunk/nhibernate/src/NHibernate.Test/Any/IPropertyValue.cs
trunk/nhibernate/src/NHibernate.Test/Any/IntegerPropertyValue.cs
trunk/nhibernate/src/NHibernate.Test/Any/Person.cs
trunk/nhibernate/src/NHibernate.Test/Any/Person.hbm.xml
trunk/nhibernate/src/NHibernate.Test/Any/Properties.hbm.xml
trunk/nhibernate/src/NHibernate.Test/Any/PropertySet.cs
trunk/nhibernate/src/NHibernate.Test/Any/StringPropertyValue.cs
Added: trunk/nhibernate/src/NHibernate.Test/Any/Address.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/Address.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/Address.cs 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,22 @@
+using Iesi.Collections;
+
+namespace NHibernate.Test.Any
+{
+ public class Address
+ {
+ private long id;
+ private ISet lines = new HashedSet();
+
+ public virtual long Id
+ {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public virtual ISet Lines
+ {
+ get { return lines; }
+ set { lines = value; }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/Any/AnyTypeTest.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/AnyTypeTest.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/AnyTypeTest.cs 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,53 @@
+using System.Collections;
+using NUnit.Framework;
+
+namespace NHibernate.Test.Any
+{
+ [TestFixture]
+ public class AnyTypeTest : TestCase
+ {
+ protected override string MappingsAssembly
+ {
+ get { return "NHibernate.Test"; }
+ }
+
+ protected override IList Mappings
+ {
+ get { return new string[] {"Any.Person.hbm.xml"}; }
+ }
+
+ protected override string CacheConcurrencyStrategy
+ {
+ get { return null; }
+ }
+
+ [Test]
+ public void FlushProcessing()
+ {
+ //http://opensource.atlassian.com/projects/hibernate/browse/HHH-1663
+ ISession session = OpenSession();
+ session.BeginTransaction();
+ Person person = new Person();
+ Address address = new Address();
+ person.Data = address;
+ session.SaveOrUpdate(person);
+ session.SaveOrUpdate(address);
+ session.Transaction.Commit();
+ session.Close();
+
+ session = OpenSession();
+ session.BeginTransaction();
+ person = (Person) session.Load(typeof (Person), person.Id);
+ person.Name = "makingpersondirty";
+ session.Transaction.Commit();
+ session.Close();
+
+ session = OpenSession();
+ session.BeginTransaction();
+ session.Delete(person);
+ session.Delete(address);
+ session.Transaction.Commit();
+ session.Close();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/Any/ComplexPropertyValue.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/ComplexPropertyValue.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/ComplexPropertyValue.cs 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,46 @@
+using System.Collections;
+using System.Text;
+
+namespace NHibernate.Test.Any
+{
+ public class ComplexPropertyValue : IPropertyValue
+ {
+ private long id;
+ private IDictionary subProperties = new Hashtable();
+
+ public virtual long Id
+ {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public virtual IDictionary SubProperties
+ {
+ get { return subProperties; }
+ set { subProperties = value; }
+ }
+
+ #region IPropertyValue Members
+
+ public virtual string AsString()
+ {
+ return "complex[" + KeyString() + "]";
+ }
+
+ #endregion
+
+ private string KeyString()
+ {
+ StringBuilder buff = new StringBuilder();
+ foreach (object key in subProperties.Keys)
+ {
+ if (buff.Length > 0)
+ {
+ buff.Append(", ");
+ }
+ buff.Append(key.ToString());
+ }
+ return buff.ToString();
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/Any/IPropertyValue.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/IPropertyValue.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/IPropertyValue.cs 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,7 @@
+namespace NHibernate.Test.Any
+{
+ public interface IPropertyValue
+ {
+ string AsString();
+ }
+}
\ No newline at end of file
Property changes on: trunk/nhibernate/src/NHibernate.Test/Any/IPropertyValue.cs
___________________________________________________________________
Added: svn:mergeinfo
+
Added: trunk/nhibernate/src/NHibernate.Test/Any/IntegerPropertyValue.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/IntegerPropertyValue.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/IntegerPropertyValue.cs 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,35 @@
+namespace NHibernate.Test.Any
+{
+ public class IntegerPropertyValue : IPropertyValue
+ {
+ private long id;
+ private int value;
+ public IntegerPropertyValue() {}
+
+ public IntegerPropertyValue(int value)
+ {
+ this.value = value;
+ }
+
+ public virtual long Id
+ {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public virtual int Value
+ {
+ get { return value; }
+ set { this.value = value; }
+ }
+
+ #region IPropertyValue Members
+
+ public virtual string AsString()
+ {
+ return value.ToString();
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/Any/Person.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/Person.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/Person.cs 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,27 @@
+namespace NHibernate.Test.Any
+{
+ public class Person
+ {
+ private object data;
+ private long id;
+ private string name;
+
+ public virtual long Id
+ {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public virtual string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public virtual object Data
+ {
+ get { return data; }
+ set { data = value; }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/Any/Person.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/Person.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/Person.hbm.xml 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.Any">
+
+ <class name="Person" table="T_ANY_PERSON">
+ <id name="Id" column="ID_">
+ <generator class="increment" />
+ </id>
+ <property name="Name" />
+ <any name="Data" id-type="long" cascade="none">
+ <meta-value value="A" class="Address"/>
+ <column name="DATATYPE_"/>
+ <column name="DATAID_"/>
+ </any>
+ </class>
+
+ <class name="Address" table="T_ANY_ADDRESS">
+ <id name="Id" column="ID_">
+ <generator class="increment" />
+ </id>
+ <set name="Lines" table="LINE">
+ <key column="ADDRESS" />
+ <element type="string" />
+ </set>
+ </class>
+
+</hibernate-mapping>
Added: trunk/nhibernate/src/NHibernate.Test/Any/Properties.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/Properties.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/Properties.hbm.xml 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.Any">
+
+ <class name="PropertySet" table="T_PROP_SET">
+ <id name="Id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="Name" column="NAME" type="string"/>
+ <any name="SomeSpecificProperty" id-type="long" meta-type="string" cascade="all">
+ <meta-value value="I" class="IntegerPropertyValue"/>
+ <meta-value value="S" class="StringPropertyValue"/>
+ <meta-value value="C" class="ComplexPropertyValue" />
+ <column name="S_S_PROP_TYPE"/>
+ <column name="S_S_PROP_ID"/>
+ </any>
+ <map name="GeneralProperties" table="T_GEN_PROPS" lazy="true" cascade="all">
+ <key column="PROP_SET_ID"/>
+ <map-key type="string" column="GEN_PROP_NAME"/>
+ <many-to-any id-type="long" meta-type="string">
+ <meta-value value="I" class="IntegerPropertyValue"/>
+ <meta-value value="S" class="StringPropertyValue"/>
+ <column name="PROP_TYPE"/>
+ <column name="PROP_ID"/>
+ </many-to-any>
+ </map>
+ </class>
+
+ <class name="StringPropertyValue" table="T_CHAR_PROP">
+ <id name="Id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="Value" column="VAL" not-null="true" type="string"/>
+ </class>
+
+ <class name="IntegerPropertyValue" table="T_NUM_PROP">
+ <id name="Id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="Value" column="VAL" not-null="true" type="integer"/>
+ </class>
+
+ <class name="ComplexPropertyValue" table="T_COMPLEX_PROP">
+ <id name="Id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <map name="SubProperties" table="T_COMPLEX_SUB_PROPS" lazy="true">
+ <key column="PROP_ID" />
+ <map-key type="string" column="SUB_PROP_NAME" />
+ <element type="string" column="SUB_PROP_VAL" />
+ </map>
+ </class>
+</hibernate-mapping>
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/Any/PropertySet.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/PropertySet.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/PropertySet.cs 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,42 @@
+using System.Collections;
+
+namespace NHibernate.Test.Any
+{
+ public class PropertySet
+ {
+ private IDictionary generalProperties = new Hashtable();
+ private long id;
+ private string name;
+ private IPropertyValue someSpecificProperty;
+ public PropertySet() {}
+
+ public PropertySet(string name)
+ {
+ this.name = name;
+ }
+
+ public virtual long Id
+ {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public virtual string Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+
+ public virtual IPropertyValue SomeSpecificProperty
+ {
+ get { return someSpecificProperty; }
+ set { someSpecificProperty = value; }
+ }
+
+ public virtual IDictionary GeneralProperties
+ {
+ get { return generalProperties; }
+ set { generalProperties = value; }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/nhibernate/src/NHibernate.Test/Any/StringPropertyValue.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/Any/StringPropertyValue.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/Any/StringPropertyValue.cs 2008-07-23 19:01:10 UTC (rev 3657)
@@ -0,0 +1,32 @@
+namespace NHibernate.Test.Any
+{
+ public class StringPropertyValue: IPropertyValue
+ {
+ private long id;
+ private string value;
+
+ public StringPropertyValue() {}
+
+ public StringPropertyValue(string value)
+ {
+ this.value = value;
+ }
+
+ public virtual long Id
+ {
+ get { return id; }
+ set { id = value; }
+ }
+
+ public virtual string Value
+ {
+ get { return value; }
+ set { this.value = value; }
+ }
+
+ public virtual string AsString()
+ {
+ return value;
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj 2008-07-23 16:56:12 UTC (rev 3656)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test-2.0.csproj 2008-07-23 19:01:10 UTC (rev 3657)
@@ -65,6 +65,14 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Any\Address.cs" />
+ <Compile Include="Any\AnyTypeTest.cs" />
+ <Compile Include="Any\ComplexPropertyValue.cs" />
+ <Compile Include="Any\IntegerPropertyValue.cs" />
+ <Compile Include="Any\Person.cs" />
+ <Compile Include="Any\PropertySet.cs" />
+ <Compile Include="Any\IPropertyValue.cs" />
+ <Compile Include="Any\StringPropertyValue.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Assertions\InheritedAreMarkedSerializable.cs" />
<Compile Include="Assertions\IsSerializable.cs" />
@@ -1368,6 +1376,8 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="DynamicEntity\Interceptor\Customer.hbm.xml" />
+ <EmbeddedResource Include="Any\Person.hbm.xml" />
+ <EmbeddedResource Include="Any\Properties.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
<EmbeddedResource Include="NHSpecificTest\NH1403\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1253\Mappings.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|