|
From: <ric...@us...> - 2009-08-17 20:50:44
|
Revision: 4695
http://nhibernate.svn.sourceforge.net/nhibernate/?rev=4695&view=rev
Author: ricbrown
Date: 2009-08-17 20:50:37 +0000 (Mon, 17 Aug 2009)
Log Message:
-----------
Merge r4694 (Fix NH-1911)
Modified Paths:
--------------
trunk/nhibernate/src/NHibernate/Criterion/AggregateProjection.cs
trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
Added Paths:
-----------
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Fixture.cs
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Mappings.hbm.xml
trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Model.cs
Modified: trunk/nhibernate/src/NHibernate/Criterion/AggregateProjection.cs
===================================================================
--- trunk/nhibernate/src/NHibernate/Criterion/AggregateProjection.cs 2009-08-17 20:40:40 UTC (rev 4694)
+++ trunk/nhibernate/src/NHibernate/Criterion/AggregateProjection.cs 2009-08-17 20:50:37 UTC (rev 4695)
@@ -57,7 +57,7 @@
{
aggregate, "(",
StringHelper.RemoveAsAliasesFromSql(projection.ToSqlString(criteria, loc, criteriaQuery,
- enabledFilters)).ToString(), ") as y",
+ enabledFilters)), ") as y",
loc.ToString(), "_"
});
}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Fixture.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Fixture.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Fixture.cs 2009-08-17 20:50:37 UTC (rev 4695)
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using NHibernate.Criterion;
+
+namespace NHibernate.Test.NHSpecificTest.NH1911
+{
+
+ [TestFixture]
+ public class Fixture : BugTestCase
+ {
+
+ protected override void OnSetUp()
+ {
+ base.OnSetUp();
+ using (ISession s = OpenSession())
+ {
+ ITransaction t = s.BeginTransaction();
+ s.Save(new LogEvent() { Name = "name parameter", Level = "Fatal" });
+ s.Save(new LogEvent() { Name = "name parameter", Level = "NonFatal" });
+ s.Save(new LogEvent() { Name = "name parameter", Level = "Fatal" });
+ t.Commit();
+ }
+ }
+
+ protected override void OnTearDown()
+ {
+ base.OnTearDown();
+ base.OnSetUp();
+ using (ISession s = OpenSession())
+ {
+ ITransaction t = s.BeginTransaction();
+ s.CreateQuery("delete from System.Object").ExecuteUpdate();
+ t.Commit();
+ }
+ }
+
+ [Test]
+ public void ConditionalAggregateProjection()
+ {
+ IProjection isError =
+ Projections.Conditional(
+ Expression.Eq("Level", "Fatal"),
+ Projections.Constant(1),
+ Projections.Constant(0));
+
+ using (ISession s = OpenSession())
+ {
+ IList<object[]> actual =
+ s.CreateCriteria<LogEvent>()
+ .Add(Expression.Eq("Name", "name parameter"))
+ .SetProjection(Projections.ProjectionList()
+ .Add(Projections.RowCount())
+ .Add(Projections.Sum(isError)))
+ .List<object[]>();
+
+ Assert.That(actual.Count, Is.EqualTo(1));
+ Assert.That(actual[0][0], Is.EqualTo(3));
+ Assert.That(actual[0][1], Is.EqualTo(2));
+ }
+ }
+
+ }
+
+}
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Mappings.hbm.xml
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Mappings.hbm.xml (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Mappings.hbm.xml 2009-08-17 20:50:37 UTC (rev 4695)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
+ assembly="NHibernate.Test"
+ namespace="NHibernate.Test.NHSpecificTest.NH1911">
+
+ <class name="LogEvent">
+ <id name="Id">
+ <generator class="native" />
+ </id>
+ <property name="Name" />
+ <property name="Level" />
+ </class>
+
+</hibernate-mapping>
Added: trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Model.cs
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Model.cs (rev 0)
+++ trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/NH1911/Model.cs 2009-08-17 20:50:37 UTC (rev 4695)
@@ -0,0 +1,20 @@
+using System;
+using System.Xml.Serialization;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+
+using NHibernate;
+using NHibernate.Classic;
+
+namespace NHibernate.Test.NHSpecificTest.NH1911
+{
+
+ public class LogEvent
+ {
+ public virtual int Id { get; set; }
+ public virtual string Name { get; set; }
+ public virtual string Level { get; set; }
+ }
+
+}
Modified: trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj
===================================================================
--- trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-17 20:40:40 UTC (rev 4694)
+++ trunk/nhibernate/src/NHibernate.Test/NHibernate.Test.csproj 2009-08-17 20:50:37 UTC (rev 4695)
@@ -579,6 +579,8 @@
<Compile Include="NHSpecificTest\NH1907\MyType.cs" />
<Compile Include="NHSpecificTest\NH1908\Fixture.cs" />
<Compile Include="NHSpecificTest\NH1908\Model.cs" />
+ <Compile Include="NHSpecificTest\NH1911\Fixture.cs" />
+ <Compile Include="NHSpecificTest\NH1911\Model.cs" />
<Compile Include="NHSpecificTest\NH1914\Fixture.cs" />
<Compile Include="NHSpecificTest\NH1914\Model.cs" />
<Compile Include="NHSpecificTest\NH1920\Fixture.cs" />
@@ -1996,6 +1998,7 @@
<EmbeddedResource Include="Criteria\Lambda\Mappings.hbm.xml" />
<EmbeddedResource Include="CfgTest\Loquacious\EntityToCache.hbm.xml" />
<Content Include="DynamicEntity\package.html" />
+ <EmbeddedResource Include="NHSpecificTest\NH1911\Mappings.hbm.xml" />
<EmbeddedResource Include="NHSpecificTest\NH1920\Mappings.hbm.xml" />
<EmbeddedResource Include="Linq\Mappings\Customer.hbm.xml" />
<EmbeddedResource Include="Linq\Mappings\Employee.hbm.xml" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|